You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Grzegorz Stasica <gs...@poczta.onet.pl> on 2005/07/17 00:12:35 UTC

ActionMessages vs ActionErrors in jstl

hi,

Basically I'd like to ask why I'm not able to access my messages stored 
in action from jsp.

ActionMessages m=new ActionMessages();
m.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("error.no_value"));
saveMessages(request,m);

in jsp I try this

<c:out 
value="${requestScope['org.apache.struts.action.GLOBAL_MESSAGES']}" />

I know I can access errors by 
${requestScope['org.apache.struts.action.ERROR']}

but isn't it weird. Why do messages can be accessed by ERROR key?
And the final question if I store my message under key "my_key" how 
should I specify package in address

<c:out value="${requestScope['org.apache.struts.action.ERROR (my_key) 
']}" /> ????


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


Re: ActionMessages vs ActionErrors in jstl

Posted by Grzegorz Stasica <gs...@poczta.onet.pl>.
Grzegorz Stasica wrote:
> hi,
> 
> Basically I'd like to ask why I'm not able to access my messages stored 
> in action from jsp.
> 
> ActionMessages m=new ActionMessages();
> m.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("error.no_value"));
> saveMessages(request,m);
> 
> in jsp I try this
> 
> <c:out 
> value="${requestScope['org.apache.struts.action.GLOBAL_MESSAGES']}" />
> 
> I know I can access errors by 
> ${requestScope['org.apache.struts.action.ERROR']}
> 
> but isn't it weird. Why do messages can be accessed by ERROR key?
> And the final question if I store my message under key "my_key" how 
> should I specify package in address
> 
> <c:out value="${requestScope['org.apache.struts.action.ERROR (my_key) 
> ']}" /> ????

My motto is: If you do not know the answer go to the sources!!

To access messages in JSTL I should write
<c:out value="${requestScope['org.apache.struts.action.ACTION_MESSAGE']}" />


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