You should be able to use BeanUtils' mapped property access for this, right?

<c:set var="modelListProp" value="modelList(${param.paramName})"/>
<jsp:useBean id="modelListProp" type="java.lang.String"/>
<bean:define id="modelList" name="bean" property="<%= modelListProp %>"/>

Which should give you a bean called "modelList" that holds your collection. This
assumes there's a bean called "bean" whose class implements the getModelList method.

Quoting Wendy Smoak <[EMAIL PROTECTED]>:

> > From: Dragos Madalin Popa [mailto:[EMAIL PROTECTED] 
> > 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 

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to