struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Longwell <>
Subject Validator + <html:select> Problem
Date Fri, 11 Jul 2003 22:16:23 GMT
I feel a little embarrased asking this question... it seems so simple...

I'm having a problem when the Validator framework actually finds a 
validation error. My form contains a dynamically created drop-down. For 
correct data, the form works just fine.

When the user submits bad data, however, they get a page with their 
errors described (<html:errors/> ), but the drop down now has no values 
in it.... and thus the cannot ever submit good data again.

When I noticed the problem, my setup included a 
request.setAttribute("listitems", items) to insert the collection in the 
Action (on my "edit" action). I realized that this process probably did 
not occur following an HTTP submit to the "update" action. So my 
solution was to put a Collection object in the ActionForm.... then 
populate the drop-down with the ActionForm's collection.... thinking 
that the ActionForm object gets passed into the Action.... shouldn't the 
data be there?

The real question is... how do I repopulate the "n" values in a 1:n 
relationship on a form? I think I'm becoming confused with the lifecycle 
of the ActionForm object, especially with regard to what is happening on 
a submit..... where do I insert form setup code that will run both when 
the user requests the form and when the user receives the form back 
after submitting invalid entries?

Thanks for the help,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message