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: logic:iterate question
Date Fri, 06 Feb 2004 18:24:39 GMT
> From: Dragos Madalin Popa [mailto:madalin@broadware.com] 
> Thank you for your answer.I would like to change the code shown below,
> to pass a request parameter to the modelList function;something like
> this:
> public Collection getModelList(String requestString){}, where
> requestString is a parameter of the http request..
> <logic:iterate id="model" name="models" property="modelList">
>   <tr>
>     <td><bean:write name="model" property="name" /></td>
>     <td><bean:write name="model" property="description" /></td>
>   </tr>
> </logic:iterate>

I don't think you can pass parameters in JSTL, at least not yet.  But
you could, in your action, call getModelList passing the String you got
from the request, and then when you forward to the JSP, iterate over
that Collection.

If getModelList returned a Map, or you made a getAllModelLists method
that returns a Map, you might have this:

<c:forEach items="${myBean.allModelLists[theRequestParam]}"
item="${model}>
   <c:out value="${model.name}"/>
</c:forEach>

That depends on how big they are, and whether they change for each user.
If you models are fixed and change infrequently, you might be able to
put a big Map in Application scope and use it across the entire webapp.

Out of curiosity, what class is getModelList from?

-- 
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