[
http://www.stripesframework.org/jira/browse/STS-618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11555#action_11555
]
Frederic Daoud commented on STS-618:
------------------------------------
My understanding is that we should be putting the properties back to the way
they were, not to null. That is, if we change the value of the label= and name=
properties to do some work, we should remember the original value and set the
properties back to the original value when we're done.
In the case of InputOptionsCollectionTag it doesn't look like we're changing
the values of the properties themselves, but instead we're using local
variables. So maybe it's just a matter of removing these lines:
this.collection = null;
this.value = null;
this.label = null;
> 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