We've found that the message tag is really "too generic" to be useful.  Making 
it a little more flexible might be helpful for some particular use case, but 
it's not going to be able to cover everything.  IMO this is something better 
done on a per-case basis by the client code and the entire feature should be 
bagged from stripes.

private List<String> errorMessages;
private List<String> warningMessages;
private List<Message> randomMessages;
private Map<String, Message> messagesAreBestLeftUpToTheClientDeveloper;

The message feature as it stands today is so simple it is about the same amount 
of work to do it yourself.  Set some state in the current action bean or 
context, and use your own jsp tagfile or freemarker macro to pull and render 
them in the same spirit of the <stripes:messages /> tag, however complex you 
need to go.  Obviously I don't think we'll see the feature cut for backwards 
compatibility reasons, but I don't think enhancing it to support X but not Y 
and Z is that good of an idea....


-----Original Message-----
From: Iwao AVE! [mailto:haraw...@gmail.com] 
Sent: Tuesday, November 30, 2010 10:11 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Different Types of Messages

Hi Nikolaos,

The 'key' attribute of MessageTag might help.

- StripesResources.properties
stripes.messages.header=<div class="message"> stripes.messages.beforeMessage= 
stripes.messages.afterMessage= stripes.messages.footer=</div>

- JSP (I would make it a tag file)
<div class="info">
<stripes:messages key="info" />
</div>
<div class="warn">
<stripes:messages key="warn" />
</div>

- CSS
div.info div.message {
...
}
div.warn div.message {
...
}

- ActionBean
// add info
getContext().getMessages("info").add("Information");
// add warn
getContext().getMessages("warn").add("Warning!");

--
And here's the doc:
http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/action/ActionBeanContext.html#getMessages(java.lang.String)

Hope this helps,
Iwao

on 10/11/30 5:54 Nikolaos Giannopoulos said the following:
> Hi,
> 
> So in Stripes we can display messages OR errors to users and 
> everything seems OK.
> Editing the resource file makes in tandem with CSS appears to work well.
> 
> However, what if one wants to display different types of messages for 
> users like a Warning and Ok (checkmark)?
> 
> e.g. "<checkmark-icon>  Your article was saved"
> e.g. "<warn-icon>  The language of this Article is English however you 
> have selected Spanish"
> 
> Is this possible with Stripes?
> 
> --Nikolaos

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by 
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to