| Author |
Strtus and popluating dropdown lists
|
scot curtis
Greenhorn
Joined: Oct 16, 2008
Posts: 1
|
|
For some reason I can't figure out what I am doing wrong when I am pre-populating a select list from a arraylist collection from my form. My flow is as follows: when a user clicks a link, I call a action class that initializes the arraylists (on the form) from the database. That part is working fine; I am getting the data and populating the labelvalue object just fine and then setting the arraylist with all the labelvalue objects. As far as my jsp goes, this is what I have: <html:select name="CreateDateForm" property="selectedStatusType"> <html ptions collection="statusTypeList" property="value" labelProperty="label"/> </html:select> Now in my form, I have the approiate getters/setters (getStatusTypeList/setStatusTypeList), however, when I load the page, I get the following error: javax.servlet.ServletException: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean under name statusTypeList Now, the weird part is that when I add the following line in my action class before I return to the jsp, it works: request.setAttribute( "statusTypeList", createDataForm.getStatusTypeList() ); Now, can anyone tell me why this is not working without the setAttribute call? I know it is something simple that I am overlooking, but I just can't think of what it is... (as a side note, all data that I have - text fields, are working fine, it is just select lists) Thanks Scot
|
 |
Tom Rispoli
Ranch Hand
Joined: Aug 29, 2008
Posts: 349
|
|
|
I think your problem is that if you want to get the list from your form you needt to use the name and property attributes of the tag, rather than the collection attribute.
|
 |
 |
|
|
subject: Strtus and popluating dropdown lists
|
|
|