This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 2 : Validation problem with dropdown box. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 : Validation problem with dropdown box." Watch "Struts 2 : Validation problem with dropdown box." New topic
Author

Struts 2 : Validation problem with dropdown box.

Praveen Kumar Singh
Ranch Hand

Joined: Mar 04, 2009
Posts: 43
Hi

I have a jsp page in which i have 2 text box with one drop down box. page is generated by a action class, which populate the data in drop down box. when i press submit, data of text field validated as per validation.xml file, in case of success go to another action class and on failure display error message on jsp page.

Now problem is when validation fails, i get the error message, but do not get back the data of drop down box.

Do we have some kind of solution by struts2 for this problem(the code is for production, hence i can't use scriplets, or some wired logic )


Praveen
SCJP, SCWCD, SOA
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That's a pretty noticeable bug to make it into production.

http://struts.apache.org/2.x/docs/how-do-we-repopulate-controls-when-validation-fails.html
Praveen Kumar Singh
Ranch Hand

Joined: Mar 04, 2009
Posts: 43
Hi David

Thanks for the answer, it helped me a lot.

It is nice to see that online docs has this solution, it is so badly written i almost stop following it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 : Validation problem with dropdown box.
 
Similar Threads
Text area and other contents are getting cleared on changing a drop down list
Selected values
Using Common Validator question
How to add error message before sendRedirect
JSF - How can I get hyperlink in error messages?