Steve:
> Currently, I am dropping a list of Strings (will be later loaded from a
> ResultSetMetaData, or similar) into the ModelResponse for use by a JSP.
>
> How do I read and iterate over the Arraylist in question in the JSP?
First suggestion: Instead of an ArrayList, how about using nested Output objects? This
would be much more portable between UI's later on, for example.
E.g.
Output titles = res.createOutput("titles");
titles.add(res.createOutput("ID"));
titles.add(res.createOutput("Title"));
titles.add(res.createOutput("Description"));
res.add(titles);
Given that these are attributes of a single title, though (going by the names), you
could also say:
Output someTitle = res.createOutput("Title");
someTitle.setAttribute("ID", "ID");
someTitle.setAttribute("Description", "someDescription");
res.add(someTitle);
> public ModelResponse execute(ModelRequest request) throws ModelException {
> final ArrayList titles = new ArrayList();
> titles.add("ID");
> titles.add("Title");
> titles.add("Description");
> ModelResponse res = request.createResponse();
> res.setAttribute("editClipTitle", titles);
> return(res);
Also, I'd recommend agsinst using response attributes for normal response data like
this. Better to reserve the attributes for things such as "forward", and things that
affect the whole response.
In the JSP, for example 1 above you can say:
<logic:iterate id="onetitle" name="titles" property="nested">
<p>Here's one nested element:<bean:write name="onetitle"/>
</logic:iterate>
Or, for example 2, you can say:
<logic:iterate id="onetitle" name="outputs">
<p>Title: <bean:write name="onetitle"/></p>
<p>ID: <bean:write name="onetitle" property="attributes.ID"/></p>
<p>Description: <bean:write name="onetitle" property="attributes.Description"/></p>
</logic:iterate>
Example 2 is probably closer to what you want I think...
Mike
JGlobal Ltd.
http://www.jglobal.com
http://keelframework.org/documentation
Keelgroup mailing list
[EMAIL PROTECTED]
http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com