• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

problem with the web.xml

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what do you expect this code to do and how is it not doing that?
 
Varun Nambuthiri
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes
 
Varun Nambuthiri
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

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

Thank you and Regards
Varun
 
Hang a left on main. Then read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic