struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <j...@wendysmoak.com>
Subject Re: Validation Post-Back help
Date Thu, 30 Dec 2004 21:00:30 GMT
From: "Daniel Kies" <danielkies@gmail.com>
> in JSP to show the list in a drop down:
> <select name="status">
> <logic:iterate indexId="id" id="statusList" name="statusList">
>         <option value="<bean:write name="statusList"
> property="statusType"/>"><bean:write name="statusList"
> property="statusType" /></option>
> </logic:iterate>
> </select>

Why are you not using the <html:select> and <html:options> (or
<html:optionsCollections>)  tags?  You don't have to iterate over the
collection, the framework will do it for you.

Example:
<html-el:select property="type">
   <html-el:options collection="contactTypes" property="key"
labelProperty="value"/>
</html-el:select>
(contactTypes is a Map sitting in Application scope, but it'll work with
other Collections in other scopes.)

Is your problem is that you are setting the values back into the form but
they are not getting 'pre-selected' by Struts?  (You need to use the Struts
tags for that to happen.)

Or is your question _how_ to set the values in the dynamic form bean?
Should be...
( (DynaActionForm) form ).set( "fieldName", myList );

Post some of the code that's giving you trouble so we can see what you're
doing instead of guessing.

-- 
Wendy Smoak


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message