This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form Validation and Delete using struts

 
rahul V kumar
Ranch Hand
Posts: 82
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a web page which has few form fields.
These form fields are populated with some data based on the user logon on.
i have two buttons. Button 1 is "Save"
and Button 2 is "Delete"
Both these buttons call the same ActionServlet.
If the user clicks "Save", I have to verify that all the fields are entered and then I have to save the data to persistent store. If the user selects "Delete" then I shouldn't be checking the data in the form fields and should delete the data from the persistent store.
I know the validation could be performed using validate method in ActionForm class.
Question 1) When the user hits the "Delete" button will the validate method be called.
If so how can i avoid calling the validate method.
Thanks in advance
 
rahul V kumar
Ranch Hand
Posts: 82
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found a way out for this one.
I was setting the form action based on the button selection
and it helped me resolve this issue
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic