[
http://www.stripesframework.org/jira/browse/STS-618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11553#action_11553
]
Nick Yantikov commented on STS-618:
-----------------------------------
For the sake of the others who run into the same problem here is the workaround
that seems to be suppressing Resin's optimization and forces setValue() and
setLabel() be called on every loop iteration:
<c:forEach...>
<c:set var="resinFixName" value="name"/>
<c:set var="resinFixId" value="id"/>
<stripes:select ...>
<stripes:options-collection
collection="${some_collection_here}" label="${resinFixName}"
value="${resinFixId}" />
</stripes:select>
</c:forEach>
> options-collection tag is rendering incorrectly when inside the loop
> --------------------------------------------------------------------
>
> Key: STS-618
> URL: http://www.stripesframework.org/jira/browse/STS-618
> Project: Stripes
> Issue Type: Bug
> Components: Tag Library
> Affects Versions: Release 1.5
> Environment: JDK 1.6.0_07, Resin 3.1.2
> Reporter: Nick Yantikov
>
> Code in question (class InputOptionsCollectionTag, method doEndTag(), lines
> 345,346) :
> this.value = null;
> this.label = null;
> Problem description:
> I have the following JSP code:
> <c:forEach ...>
> ...
> <stripes:select ...>
> <stripes:options-collection collection="some_collection_here"
> label="name" value="id" />
> </stripes:select>
> ...
> </c:forEach>
> As a result of the JSP translation Resin generates the following java code:
> while (_jsp_iter_269.hasNext()) {
> ...skip...
> if (_jsp_InputOptionsCollectionTag_18 == null) {
> _jsp_InputOptionsCollectionTag_18 = new
> net.sourceforge.stripes.tag.InputOptionsCollectionTag();
> _jsp_InputOptionsCollectionTag_18.setPageContext(pageContext);
>
> _jsp_InputOptionsCollectionTag_18.setParent((javax.servlet.jsp.tagext.Tag)
> _jsp_InputSelectTag_17);
> _jsp_InputOptionsCollectionTag_18.setLabel("name");
> _jsp_InputOptionsCollectionTag_18.setValue("id");
> }
>
> _jsp_InputOptionsCollectionTag_18.setCollection(_caucho_expr_5.evalObject(_jsp_env));
> _jsp_InputOptionsCollectionTag_18.doStartTag();
> _jsp_InputOptionsCollectionTag_18.doEndTag();
> ...skip...
> }
> As you can see setLabel(), setValue() are only called once in the loop right
> after tag instance is lazily instantiated inside "if" statement.
> Once doEndTag() method is executed during the first iteration "value" and
> "label" properties are nulled and then the next iteration results in
> incorrect HTML rendering.
> Apparently Resin applies the same paradigm of tag initialization to every jsp
> tag, so this particular problem may potentially exist with other stripes's
> tags if they have similar "clean up" code at the end of the doEndTag().
> It appears that Stripes 1.4.3 does not have this problem and problem only
> appeared in 1.5
> I have not tested this particular test case with other web containers, and
> not sure if this sort of the "optimization" performed by Resin is
> appropriate, but on the other hand from the pure theoretical point of view
> since we do not control initialization of the tag properties shouldn't we be
> cleaning them ourselves?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development