On 6/7/06, Adam Samere <[EMAIL PROTECTED]> wrote:
Niall Pemberton wrote:
> On 6/7/06, Joe Germuska <[EMAIL PROTECTED]> wrote:
>> At 12:47 PM -0700 6/7/06, Chris Cheshire wrote:
>> >In my actions I have messages stored in the session either under
>> >ActionMessages.GLOBAL_MESSAGE, or my own key (eg 'search').
>> >
>> >In my jsp I have a section to display the search specific messages.
>> ><logic:messagesPresent message="true" property="search">
>> >....
>> ></logic:messagesPresent>
>> >
>> >I also need to display the global messages at the top of the page,
>> >however this displays everything, including the search messages:
>> >
>> ><logic:messagesPresent message="true">
>> >...
>> ></logic:messagesPresent>
>> >
>> >What do I set for the property to ONLY display the messages keyed by
>> >ActionMessages.GLOBAL_MESSAGE?
>>
>> technically, you would use
>>
>> <logic:messagesPresent message="true"
>> property="org.apache.struts.action.GLOBAL_MESSAGE">
>> ....
>> </logic:messagesPresent>
>>
>> It has been observed that this is kind of cumbersome.  A nice
>> enhancement (that just about any willing volunteer could do, hint
>> hint :-) ) would be to enhance the logic:messagesPresent,
>> logic:messagesNotPresent, and html:messages and html:errors tags to
>> have another attribute, "global" which if it had the value"true"
>> would save you from needing to know that verbose property name.
>
> AFAIK there is no actual processing related to
> ActionMessages.GLOBAL_MESSAGE in Struts and it just means its a far
> more cumbersome key to use than something simple like a property name
> of "global" and IMO property="global" is not much different than
> global="true". I also think adding another attribute just adds
> confusion with global="true" being an alias for
> property="org.apache.struts.action.GLOBAL_MESSAGE"
>
>
> AFAIK there is no actual processing related to
> ActionMessages.GLOBAL_MESSAGE in Struts and adding another attribute
> just adds confusion with global="true" being an alias for
> property="org.apache.struts.action.GLOBAL_MESSAGE". Better for people
> to just use their own simpler property names to achieve the same thing
> - for example property="global" works just as well?
>
> Niall
>
This works fine if you handle it in the manner you described previously,
but does not account for any messages added by the framework, other
developers, etc. and forces developers to either implement their own
solution for "Give me all messages that have not been stored under a
custom property", hard code the org.apache.struts.action.GLOBAL_MESSAGE
key, or use scriptlets to grab the value. No?

Not sure I understand this - to my knowledge the framework doesn't add
any "global" messages. Also how does implementing a key of
"org.apache.struts.action.GLOBAL_MESSAGE" differ from implementing
your "own solution" of another key value - except that the other key
value doesn't have to be as cumbersome? Whatever you and "other
developers" do you have to agree to handshake on these things -
whether its with this value of the key or your own.

My sense of reading your comment is that you think that Struts is
providing you with some sort of solution - when in reality it isn't
actually doing anything wrt to this constant.

Niall

>> Joe
>>
>> --
>> Joe Germuska
>> [EMAIL PROTECTED] * http://blog.germuska.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to