You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pedro Salgado <sa...@04web.com> on 2004/03/23 13:06:52 UTC

html:messages jstl equivalent


<html:messages id="error">

 ...

</html:messages>

  Does anyone know how do I fill the ${???} to have a JSTL equivalent for
the previous html tag?

  <c:forEach items='${???}' var='error'>

   ...

  </c:forEach>


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


Re: html:messages jstl equivalent

Posted by Pedro Salgado <sa...@04web.com>.
On 23/03/2004 23:39, "Joe Germuska" <Jo...@Germuska.com> wrote:

> At 12:06 PM +0000 3/23/04, Pedro Salgado wrote:
>> <html:messages id="error">
>> 
>>  ...
>> 
>> </html:messages>
>> 
>>   Does anyone know how do I fill the ${???} to have a JSTL equivalent for
>> the previous html tag?
>> 
>>   <c:forEach items='${???}' var='error'>
>> 
>>    ...
>> 
>>   </c:forEach>
> 
> The keys are defined in org.apache.struts.Globals:
> 
> 
> org.apache.struts.Globals.ERROR_KEY = "org.apache.struts.action.ERROR"
> org.apache.struts.Globals. MESSAGE_KEY  =
> "org.apache.struts.action.ACTION_MESSAGE"
> 
> 
> Until recently, the messages were always stored in request scope, so
> 
> ${requestScope['org.apache.struts.action.ERROR']}
> 

  This was what I was looking for :)

> In recent nightly builds, the ability to store the messages in the
> session instead was added.

  If something changes in the future (it seems like so) then it would only
need a test to check if the messages were on the session or request scope.
Please correct me if I am wrong.

> 
> I'm not sure I believe that this is a case where using the JSTL is
> better than using the Struts tags.  It seems to me that leaving the
> coordination inside Struts classes is the way to go.  Also, there is
> no JSTL solution as clean as using the "property" attribute of
> html:messages to filter to only include messages associated with a
> specific property.
> 
> I'm all for people using the JSTL wherever its better, but I'm not
> sure its better here...
> 

  You're right but it is easier for someone to start playing with JSTL
(specially if you had experience in JSP), learn the basics and start
producing code and, in parallel, making a step-by-step understanding of how
Struts works. In a team, I think this will work better (at least I hope so).

  To learn Struts tags right away it requires a double effort: understanding
Struts and taglibs (I have seen this happen and it didn't turn out very
well).

  Thank you for your help,

Pedro Salgado


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


Re: html:messages jstl equivalent

Posted by Joe Germuska <Jo...@Germuska.com>.
At 12:06 PM +0000 3/23/04, Pedro Salgado wrote:
><html:messages id="error">
>
>  ...
>
></html:messages>
>
>   Does anyone know how do I fill the ${???} to have a JSTL equivalent for
>the previous html tag?
>
>   <c:forEach items='${???}' var='error'>
>
>    ...
>
>   </c:forEach>

The keys are defined in org.apache.struts.Globals:


org.apache.struts.Globals.ERROR_KEY = "org.apache.struts.action.ERROR"
org.apache.struts.Globals. MESSAGE_KEY  = 
"org.apache.struts.action.ACTION_MESSAGE"


Until recently, the messages were always stored in request scope, so

${requestScope['org.apache.struts.action.ERROR']}

In recent nightly builds, the ability to store the messages in the 
session instead was added.

I'm not sure I believe that this is a case where using the JSTL is 
better than using the Struts tags.  It seems to me that leaving the 
coordination inside Struts classes is the way to go.  Also, there is 
no JSTL solution as clean as using the "property" attribute of 
html:messages to filter to only include messages associated with a 
specific property.

I'm all for people using the JSTL wherever its better, but I'm not 
sure its better here...

Joe

-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
       "Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining."
             -- Jef Raskin

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