aspose file tools*
The moose likes Struts and the fly likes How to practice struts in Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to practice struts in Eclipse" Watch "How to practice struts in Eclipse" New topic
Author

How to practice struts in Eclipse

sudha javvadi
Ranch Hand

Joined: Mar 23, 2007
Posts: 97
Hi All,

I am new to Struts. I want to practice Struts in Eclipse. I am reading Struts in Action book. What are the steps I have to do to download and to configure with Eclipse.

Thanks in advance,
sudha.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Just download the latest version of Eclipse Europa, making sure to select the option "Eclipse IDE for Java EE Developers". Then download the latest version of Struts 1, which is currently version 1.3.8 from the Struts home page and unzip it. Then all you have to do is import the struts-blank-1.3.8.war file that comes with the download into eclipse and you have a Struts application set up in eclipse that you can then add elments to.

Before you can test your application in Eclipse, you will have to set up an application server such as Tomcat and then configure Eclipse so that it knows where the server is. If you don't know how to do this, consult the Eclipse help documentation.


Merrill
Consultant, Sima Solutions
sudha javvadi
Ranch Hand

Joined: Mar 23, 2007
Posts: 97
Hi Merill,

Thank you for your response. I have downloaded Eclipse and configured with Tomcat 6. I did some servlets and JSP prgrams on that. Can you tell me how to import Struts into Eclipse, and how to set up a Struts application in Eclipse.

Thank you in advance,
Sudha.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
File->Import->Web->War File. Click the next button and browse for the struts-blank-1.3.8.war file that came with your Struts download. Select Tomcat as the target runtime and click Finish. You now have a Struts project with all the essential elements.
sudha javvadi
Ranch Hand

Joined: Mar 23, 2007
Posts: 97
Hi Merrill,

I successfully downloaded and configured struts with eclipse as you told. Now I want to test it. where I need to store my jsp's and Action classes?As per my knowledge, Jsp's go under pages folder and Action classes go under build->classes. correct me if I am wrong.

thank you.
sudha.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Hi suddha,

you just click help in eclipse..then type "struts" in search column..
Enter...then you will get the aa details with small example program..

Hope that will help you

thanks & regards,
seetharaman
sudha javvadi
Ranch Hand

Joined: Mar 23, 2007
Posts: 97
Hi seetharam,

I got nothing found when I searched in eclipse help.
could you please guide me where to put my Jsp's, action forms and action classes.

thanks
sudha.
sudha javvadi
Ranch Hand

Joined: Mar 23, 2007
Posts: 97
Hi all,

I downloaded struts1.3.8 and configured struts-blank.war with eclipse IDE.Under JavaResources:src i created a package named actions and I created an action class.Under pages folder(came along with struts-blank.war) I created an Jsp page.I dont know how to use Ant. I came to know that struts ships with ant build.xml file,but I didn't see anything under Web-Inf/src.what i have to do to run my first application?

Thanks in advance,
sudha.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You don't need Ant to deploy and run a Struts project in Eclipse.

Once you've imported the struts-blank war file, deploying and running a Struts application in Eclipse is no different than deploying and running any other web application from Eclipse.

If you don't know how to deploy and run a web application from Eclipse, you will have to spend some time getting familiar with the Eclipse Web tools. The best way to do this is to read the Eclipse help documentation. I'd suggest you read the entire section: Web Application Development User Guide->Using the Server tools->Application Testing and Publishing.
[ April 24, 2008: Message edited by: Merrill Higginson ]
dayanand chowdhary
Greenhorn

Joined: Jun 18, 2011
Posts: 4
Merrill Higginson wrote:File->Import->Web->War File. Click the next button and browse for the struts-blank-1.3.8.war file that came with your Struts download. Select Tomcat as the target runtime and click Finish. You now have a Struts project with all the essential elements.





when i import struts-blank.war file from jakarata-struts-1.1, i am getting an error in validation.xml,
which is there in WEB-INF folder, can any one help out


validation.xml :-

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">

<form-validation>

<!--
This is a blank Validator form file with a commented examples.
-->

<global>

<!-- An example global constant
<constant>
<constant-name>postalCode</constant-name>
<constant-value>^\d{5}\d*$</constant-value>
</constant>
end example-->

</global>

<formset> i got err in this line stating that-->the content element type “formset” is incomplete,it must match “(constant *,form+)”

<!-- An example form
<form name="logonForm">
<field
property="username"
depends="required">
<arg0 key="logonForm.username"/>
</field>
<field
property="password"
depends="required,mask">
<arg0 key="logonForm.password"/>
<var>
<var-name>mask</var-name>
<var-value>^[0-9a-zA-Z]*$</var-value>
</var>
</field>
</form>
end example form -->

</formset>

<!-- An example formset for another locale
<formset language="fr">

<constant>
<constant-name>postalCode</constant-name>
<constant-value>^[0-9a-zA-Z]*$</constant-value>
</constant>

</formset>
-->

</form-validation>

what mistake i have done.?
can any one help me out.

thanks in advance
Daya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to practice struts in Eclipse