Hello,
I want to use stripes indexed properties in my jsp pages, but I have
encountered some problems in doing so, although I tried to follow closing the
example provided on the web site.
I have the folowing jsp page:
<stripes:form
beanclass="dms.web.stripes.actions.document.AddDocumentFolderActionBean">
<stripes:errors/>
<stripes:label for="documentFolder.name"/>
<stripes:text name="documentFolder.name"/>
<stripes:label for="documentFolder.moderator"/>
<stripes:select name="documentFolder.moderator.id">
<stripes:options-collection
collection="${requestScope.actionBean.allModerators}" label="email" value="id"/>
</stripes:select>
<table class="display">
<tr>
<th>Param</th>
<th>Value</th>
</tr>
<c:forEach items="${requestScope.actionBean.allParams}" var="param"
varStatus ="status">
<stripes:hidden
name="documentFolder.paramDocumentFolder[${status.index}].param.id"
value="${param.id}"/>
<tr>
<td><stripes:text
name="documentFolder.paramDocumentFolder[${status.index}].param.name"
value="${param.name}" readonly="true"/></td>
<td><stripes:text
name="documentFolder.paramDocumentFolder[${status.index}].value"/></td>
</tr>
</c:forEach>
</table>
<stripes:submit name="save"/>
<stripes:reset name="Reset"/>
</stripes:form>
The generated HTML page looks like this:
<form action="/dms-web/actions/document/AddDocumentFolder.action" method="post">
<label for="documentFolder.name">Document Folder Name</label>
<input name="documentFolder.name" type="text" />
<label for="documentFolder.moderator">Document Folder Moderator</label>
<select name="documentFolder.moderator.id">
<option value="1">user1</option><option value="2">user1</option><option
value="3">moh</option>
</select>
<table class="display">
<tr>
<th>Param</th>
<th>Value</th>
</tr>
<input name="documentFolder.paramDocumentFolder[0].param.id" value=""
type="hidden" />
<tr>
<td><input name="param.name" type="text" readonly="readonly" /></td>
<td><input name="documentFolder.paramDocumentFolder[0].value"
value="2" type="text" /></td>
</tr>
<input name="documentFolder.paramDocumentFolder[1].param.id" value=""
type="hidden" />
<tr>
<td><input name="param.name" type="text" readonly="readonly" /></td>
<td><input name="documentFolder.paramDocumentFolder[1].value"
value="5" type="text" /></td>
</tr>
</table>
<input name="save" type="submit" />
<input name="Reset" type="reset" />
The problem is that for the
<stripes:hidden
name="documentFolder.paramDocumentFolder[${status.index}].param.id"
value="${param.id}"/>
the generated HTML is:
<input name="documentFolder.paramDocumentFolder[0].param.id" value=""
type="hidden" />
which means the "value" attribute is empty although its value should come from
{param.id}
Also, for the
<stripes:text
name="documentFolder.paramDocumentFolder[${status.index}].param.name"
value="${param.name}" readonly="true"/>
the HTML generated is:
<input name="param.name" type="text" readonly="readonly" />This is strange to
me, because I was expecting the name attribute of the input tag to be
documentFolder.paramDocumentFolder[0].param.name and in fact it is param.name.
Besides this, the value of the tag is not set to the value of the param.name,
but it is missing completely.
I have changed the jsp to:
<stripes:text
name="documentFolder.paramDocumentFolder[${status.index}].param.name"
value="bla" readonly="true"/>
and the HTML tag that was generated was:
<input name="documentFolder.paramDocumentFolder[1].param.name" value="bla"
type="text" readonly="readonly" />So, when using a static value for the value
attribute the HTML tag is generated correctly.
The Stripes version I use is 1.5.2.
Can you help me?
Thanks.
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users