You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Jasper Rosenberg (JIRA)" <ji...@apache.org> on 2009/07/14 17:18:58 UTC

[jira] Created: (WW-3188) Don't render action errors/messages when have null message

Don't render action errors/messages when have null message
----------------------------------------------------------

                 Key: WW-3188
                 URL: https://issues.apache.org/struts/browse/WW-3188
             Project: Struts 2
          Issue Type: Improvement
    Affects Versions: 2.1.7
         Environment: Freemarker
            Reporter: Jasper Rosenberg
            Priority: Minor
             Fix For: 2.1.8


Often I will end up passing an actionMessage to be rendered via an url such as:

http://www.myco.com/myapp/doit.action?actionMessages=Display+This+Message

This message is often set dynamically in the result for a redirect, for example:
<result type="redirect">http://www.myco.com/myapp/doit.action?actionMessages=${actionMessages[0]}</result>

But of course there may be no actionMessage actually available, and so the url ends up: 
http://www.myco.com/myapp/doit.action?actionMessages=

In this case we end up with one null action message in the actionMessages list, and so when you use the actionmessage tag, you get a list with "null" as the message.

I worked around this by just overriding the actionmessage.ftl and actionerror.ftl templates to check that if the list has content, the first element also "?has_content".  This isn't terribly general though.  

I think a decent  improvement would be to just check each action message with ?has_content (which checks for null and empty string) as you iterate and only render the "li" if it is true.  Then just only output the starting "ul" when hit the first one, and the terminating ul if there was a message with content found.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-3188) Don't render action errors/messages when have null message

Posted by "Jasper Rosenberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-3188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46572#action_46572 ] 

Jasper Rosenberg commented on WW-3188:
--------------------------------------

Awesome, thanks for covering this case!

> Don't render action errors/messages when have null message
> ----------------------------------------------------------
>
>                 Key: WW-3188
>                 URL: https://issues.apache.org/struts/browse/WW-3188
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.1.6
>         Environment: Freemarker
>            Reporter: Jasper Rosenberg
>            Priority: Minor
>             Fix For: 2.1.8
>
>
> Often I will end up passing an actionMessage to be rendered via an url such as:
> http://www.myco.com/myapp/doit.action?actionMessages=Display+This+Message
> This message is often set dynamically in the result for a redirect, for example:
> <result type="redirect">http://www.myco.com/myapp/doit.action?actionMessages=${actionMessages[0]}</result>
> But of course there may be no actionMessage actually available, and so the url ends up: 
> http://www.myco.com/myapp/doit.action?actionMessages=
> In this case we end up with one null action message in the actionMessages list, and so when you use the actionmessage tag, you get a list with "null" as the message.
> I worked around this by just overriding the actionmessage.ftl and actionerror.ftl templates to check that if the list has content, the first element also "?has_content".  This isn't terribly general though.  
> I think a decent  improvement would be to just check each action message with ?has_content (which checks for null and empty string) as you iterate and only render the "li" if it is true.  Then just only output the starting "ul" when hit the first one, and the terminating ul if there was a message with content found.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-3188) Don't render action errors/messages when have null message

Posted by "Jasper Rosenberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-3188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jasper Rosenberg updated WW-3188:
---------------------------------

    Affects Version/s:     (was: 2.1.7)
                       2.1.6

> Don't render action errors/messages when have null message
> ----------------------------------------------------------
>
>                 Key: WW-3188
>                 URL: https://issues.apache.org/struts/browse/WW-3188
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.1.6
>         Environment: Freemarker
>            Reporter: Jasper Rosenberg
>            Priority: Minor
>             Fix For: 2.1.8
>
>
> Often I will end up passing an actionMessage to be rendered via an url such as:
> http://www.myco.com/myapp/doit.action?actionMessages=Display+This+Message
> This message is often set dynamically in the result for a redirect, for example:
> <result type="redirect">http://www.myco.com/myapp/doit.action?actionMessages=${actionMessages[0]}</result>
> But of course there may be no actionMessage actually available, and so the url ends up: 
> http://www.myco.com/myapp/doit.action?actionMessages=
> In this case we end up with one null action message in the actionMessages list, and so when you use the actionmessage tag, you get a list with "null" as the message.
> I worked around this by just overriding the actionmessage.ftl and actionerror.ftl templates to check that if the list has content, the first element also "?has_content".  This isn't terribly general though.  
> I think a decent  improvement would be to just check each action message with ?has_content (which checks for null and empty string) as you iterate and only render the "li" if it is true.  Then just only output the starting "ul" when hit the first one, and the terminating ul if there was a message with content found.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-3188) Don't render action errors/messages when have null message

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-3188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46480#action_46480 ] 

Dave Newton commented on WW-3188:
---------------------------------

Why would you pass action messages in a URL?!

> Don't render action errors/messages when have null message
> ----------------------------------------------------------
>
>                 Key: WW-3188
>                 URL: https://issues.apache.org/struts/browse/WW-3188
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.1.6
>         Environment: Freemarker
>            Reporter: Jasper Rosenberg
>            Priority: Minor
>             Fix For: 2.1.8
>
>
> Often I will end up passing an actionMessage to be rendered via an url such as:
> http://www.myco.com/myapp/doit.action?actionMessages=Display+This+Message
> This message is often set dynamically in the result for a redirect, for example:
> <result type="redirect">http://www.myco.com/myapp/doit.action?actionMessages=${actionMessages[0]}</result>
> But of course there may be no actionMessage actually available, and so the url ends up: 
> http://www.myco.com/myapp/doit.action?actionMessages=
> In this case we end up with one null action message in the actionMessages list, and so when you use the actionmessage tag, you get a list with "null" as the message.
> I worked around this by just overriding the actionmessage.ftl and actionerror.ftl templates to check that if the list has content, the first element also "?has_content".  This isn't terribly general though.  
> I think a decent  improvement would be to just check each action message with ?has_content (which checks for null and empty string) as you iterate and only render the "li" if it is true.  Then just only output the starting "ul" when hit the first one, and the terminating ul if there was a message with content found.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-3188) Don't render action errors/messages when have null message

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-3188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46484#action_46484 ] 

Dave Newton commented on WW-3188:
---------------------------------

Hmm, not really--whenever I've worked w/ load-balanced systems the sessions were shared, so things like the message store interceptor work.

> Don't render action errors/messages when have null message
> ----------------------------------------------------------
>
>                 Key: WW-3188
>                 URL: https://issues.apache.org/struts/browse/WW-3188
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.1.6
>         Environment: Freemarker
>            Reporter: Jasper Rosenberg
>            Priority: Minor
>             Fix For: 2.1.8
>
>
> Often I will end up passing an actionMessage to be rendered via an url such as:
> http://www.myco.com/myapp/doit.action?actionMessages=Display+This+Message
> This message is often set dynamically in the result for a redirect, for example:
> <result type="redirect">http://www.myco.com/myapp/doit.action?actionMessages=${actionMessages[0]}</result>
> But of course there may be no actionMessage actually available, and so the url ends up: 
> http://www.myco.com/myapp/doit.action?actionMessages=
> In this case we end up with one null action message in the actionMessages list, and so when you use the actionmessage tag, you get a list with "null" as the message.
> I worked around this by just overriding the actionmessage.ftl and actionerror.ftl templates to check that if the list has content, the first element also "?has_content".  This isn't terribly general though.  
> I think a decent  improvement would be to just check each action message with ?has_content (which checks for null and empty string) as you iterate and only render the "li" if it is true.  Then just only output the starting "ul" when hit the first one, and the terminating ul if there was a message with content found.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-3188) Don't render action errors/messages when have null message

Posted by "Jasper Rosenberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-3188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46482#action_46482 ] 

Jasper Rosenberg commented on WW-3188:
--------------------------------------

Our servers are load balanced and stateless (and we can't rely on a sticky server cookie) so after a form submission, when we redirect the user back to where they started the form submission flow (say by clicking on a callout), we often pass an action message in the url to display in the shared header, for example: "Thank you, your review has been submitted"

It's certainly not my favorite flow in the world, can you recommend a better approach?

> Don't render action errors/messages when have null message
> ----------------------------------------------------------
>
>                 Key: WW-3188
>                 URL: https://issues.apache.org/struts/browse/WW-3188
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.1.6
>         Environment: Freemarker
>            Reporter: Jasper Rosenberg
>            Priority: Minor
>             Fix For: 2.1.8
>
>
> Often I will end up passing an actionMessage to be rendered via an url such as:
> http://www.myco.com/myapp/doit.action?actionMessages=Display+This+Message
> This message is often set dynamically in the result for a redirect, for example:
> <result type="redirect">http://www.myco.com/myapp/doit.action?actionMessages=${actionMessages[0]}</result>
> But of course there may be no actionMessage actually available, and so the url ends up: 
> http://www.myco.com/myapp/doit.action?actionMessages=
> In this case we end up with one null action message in the actionMessages list, and so when you use the actionmessage tag, you get a list with "null" as the message.
> I worked around this by just overriding the actionmessage.ftl and actionerror.ftl templates to check that if the list has content, the first element also "?has_content".  This isn't terribly general though.  
> I think a decent  improvement would be to just check each action message with ?has_content (which checks for null and empty string) as you iterate and only render the "li" if it is true.  Then just only output the starting "ul" when hit the first one, and the terminating ul if there was a message with content found.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WW-3188) Don't render action errors/messages when have null message

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-3188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-3188.
---------------------------------

    Resolution: Fixed

fixed in trunk. The errors/messages will be printed only if the list contains at least one non blank(null or empty string) element

> Don't render action errors/messages when have null message
> ----------------------------------------------------------
>
>                 Key: WW-3188
>                 URL: https://issues.apache.org/struts/browse/WW-3188
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.1.6
>         Environment: Freemarker
>            Reporter: Jasper Rosenberg
>            Priority: Minor
>             Fix For: 2.1.8
>
>
> Often I will end up passing an actionMessage to be rendered via an url such as:
> http://www.myco.com/myapp/doit.action?actionMessages=Display+This+Message
> This message is often set dynamically in the result for a redirect, for example:
> <result type="redirect">http://www.myco.com/myapp/doit.action?actionMessages=${actionMessages[0]}</result>
> But of course there may be no actionMessage actually available, and so the url ends up: 
> http://www.myco.com/myapp/doit.action?actionMessages=
> In this case we end up with one null action message in the actionMessages list, and so when you use the actionmessage tag, you get a list with "null" as the message.
> I worked around this by just overriding the actionmessage.ftl and actionerror.ftl templates to check that if the list has content, the first element also "?has_content".  This isn't terribly general though.  
> I think a decent  improvement would be to just check each action message with ?has_content (which checks for null and empty string) as you iterate and only render the "li" if it is true.  Then just only output the starting "ul" when hit the first one, and the terminating ul if there was a message with content found.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-3188) Don't render action errors/messages when have null message

Posted by "Jasper Rosenberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-3188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46488#action_46488 ] 

Jasper Rosenberg commented on WW-3188:
--------------------------------------

Ah shared sessions, you are livin' the dream! 

If Facebook ever fixes the inexplicably case sensitive "expires" attribute parsing on their application cookies we might actually be able to at least get back to sticky servers, but that is a report for a different bug tracker :)

> Don't render action errors/messages when have null message
> ----------------------------------------------------------
>
>                 Key: WW-3188
>                 URL: https://issues.apache.org/struts/browse/WW-3188
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.1.6
>         Environment: Freemarker
>            Reporter: Jasper Rosenberg
>            Priority: Minor
>             Fix For: 2.1.8
>
>
> Often I will end up passing an actionMessage to be rendered via an url such as:
> http://www.myco.com/myapp/doit.action?actionMessages=Display+This+Message
> This message is often set dynamically in the result for a redirect, for example:
> <result type="redirect">http://www.myco.com/myapp/doit.action?actionMessages=${actionMessages[0]}</result>
> But of course there may be no actionMessage actually available, and so the url ends up: 
> http://www.myco.com/myapp/doit.action?actionMessages=
> In this case we end up with one null action message in the actionMessages list, and so when you use the actionmessage tag, you get a list with "null" as the message.
> I worked around this by just overriding the actionmessage.ftl and actionerror.ftl templates to check that if the list has content, the first element also "?has_content".  This isn't terribly general though.  
> I think a decent  improvement would be to just check each action message with ?has_content (which checks for null and empty string) as you iterate and only render the "li" if it is true.  Then just only output the starting "ul" when hit the first one, and the terminating ul if there was a message with content found.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.