aspose file tools*
The moose likes Struts and the fly likes problem with the web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem with the web.xml" Watch "problem with the web.xml" New topic
Author

problem with the web.xml

Varun Nambuthiri
Ranch Hand

Joined: Sep 20, 2010
Posts: 76
Hi,

This forum is the best place to be if I have any doubts at all . Thanks for all the help till now .

I am working with Struts1.x and I seem to be having trouble in doing anything actually . I created this simple login page and form bean for that page . Then an action class to work on the page request .

Here is the code .

this is login.html


then here it the form bean LoginForm.java



then there is the web.xml ( which i think seems to be causing the problem )



struts-config.xml



If needed anything else please do tell me . Thank you

Regards Varun


All's well that Debugs well .
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

So what do you expect this code to do and how is it not doing that?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Varun Nambuthiri
Ranch Hand

Joined: Sep 20, 2010
Posts: 76
Hi ,

thanks for the reply . Since i am new to this Struts 1.x , I dont know how the mapping occurs but the basic flow that I want to follow is HTML -> Form Bean (Storing the HTML field data ) -> Action ( where the data from Form bean is taken) -> action forward -> result page .

And since the page is not doin anything I am wondering the problem maybe with the web.xml file .

Thanks and regards
Varun
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

Unless you have a good reason to learn Struts 1.x, like you are going to be maintaining an existing application, I recommend you learn Struts 2.x. Struts 1.x has some serious drawbacks that Struts 2.x addresses.
That said, you have to tell the form where to send the data. Look up the "action" attribute for the HTML form tag.
Varun Nambuthiri
Ranch Hand

Joined: Sep 20, 2010
Posts: 76
Hi ,

Thanks for the reply . Yes I do have to maintain an application which was implemented in Struts 1.x . And I did look up the "action" tag . But I could specify the action but that would lead the flow directly to the action whereas I need the data from the HTML form to stored in Form Bean first .

Thank you and Regards
Varun
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

Varun Nambuthiri wrote:I need the data from the HTML form to stored in Form Bean first .


That's what Struts does. It populates the bean, uses the bean to do validation (if the validate method is implemented), then passes it to the action.
Varun Nambuthiri
Ranch Hand

Joined: Sep 20, 2010
Posts: 76
Hi ,

Thanks for the reply . So does it mean that if i just give the action in the <form> then it till automatically populate the bean ?

Thank you and Regards
Varun
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

Yes
Varun Nambuthiri
Ranch Hand

Joined: Sep 20, 2010
Posts: 76
Hi ,

Thanks Joe !! Will try it and let you know !! Your the best !

Thank you and Regards
Varun
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with the web.xml