struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <Wendy.Sm...@asu.edu>
Subject RE: Struts, Search Page, Help!!!
Date Wed, 21 Jan 2004 14:50:15 GMT
> From: Matthew J. Vincent [mailto:vincent@cs.usm.maine.edu] 
> I need some serious help with Struts.
> I have a page that gets invoked by calling search.do, this in 
> turns calls my SearchAction which gets data from a database 
> to populate a select box in my JSP search.jsp.
> 
> <select name="strainType">
>     <option selected value="">ANY
>     <c:forEach var="strainType" items="${strainTypes}" 
> varStatus="status">
>            <option><c:out value="${strainType}" 
> escapeXml="false"/></option>
>     </c:forEach>
> </select>

You don't have to do the iteration, and since you're familiar with JSTL,
the Struts-EL tags are probably what you want.  Here's an example that
shows a select list of months, which are stored in a Map:

<html-el:select property="calendarMonth">
  <html-el:options collection="months" property="key"
labelProperty="value"/>
</html-el:select>

Putting the form bean in session scope neatly solves the
blank-form-on-validation-error.  It looks like you've done that, but by
not using the Struts tags, you're not giving the framework a chance to
populate the form.

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 



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


Mime
View raw message