You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2005/08/19 17:15:29 UTC

DO NOT REPLY [Bug 36276] New: - Struts Tag sets message to null when iterating 2nd time

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36276>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36276

           Summary: Struts Tag <html:messages/> sets message to null when
                    iterating 2nd time
           Product: Struts
           Version: 1.2.7
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Custom Tags
        AssignedTo: dev@struts.apache.org
        ReportedBy: cey@mgm-edv.de


Struts Tag <html:messages/> sets current message to null if the message type
"resource" is set to false.

This results in an exception when the JSP is evaluated: <bean:write/> doesn't
find the bean in expected page scope.

I found the error in the code of the implementing tag class.

class: org.apache.struts.taglib.html.MessagesTag
CVS Id: $Id: MessagesTag.java 164530 2005-04-25 03:11:07Z niallp $
release: Struts 1.2.7

erroneous code (lines 253..260):
            ActionMessage report = (ActionMessage) iterator.next();
            String msg =
                TagUtils.getInstance().message(
                    pageContext,
                    bundle,
                    locale,
                    report.getKey(),
                    report.getValues());

should be replaced by:
        ActionMessage report = (ActionMessage) this.iterator.next();
        String msg = null;
        if (report.isResource()) {
            msg = TagUtils.getInstance().message(
                     pageContext,
                     bundle,
                     locale,
                     report.getKey(),
                     report.getValues());
        } else {
            msg = report.getKey();
        }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org