java - How to retrieve a message with a specific key from <stripes:messages> of Stripes Framework -
i want retrieve message specific key tag of stripes framework.
in action bean have this:
switch (result) { case reg_already_registered: getcontext().getmessages().add(new localizablemessage("consumer.already.registered")); redirect = getcontext().getsourcepageresolution(); break;
in jsp page:
<stripes:messages key="consumer.already.registered"/>
but above code not seem work. if putting "<stripes:messages/>
" shows stripes's default way of printing messages. i.e, "ul li" thing. want give kind of presentation messages. there possible jsp follows:
<c:if test="${not empty actionbean.context.messages}"> <c:out value="${actionbean.context.messages......"/> //this place unsure </c:if>
there feature request filed have additional tags displaying messages : http://www.stripesframework.org/jira/browse/sts-245.
if don't default messages headers , footers, have change them through properties described in documentation: http://stripes.sourceforge.net/docs/current/taglib/stripes/messages.html. change headers , footers pages, though. if want change them 1 specific page, there no other way, afaik, doing this:
<c:if test="${not empty actionbean.context.messages}"> <c:foreach var="message" items=${"actionbean.context.messages}"> ${myfn:getmessagetext(message, getpagecontext.request.locale)} </c:foreach> </c:if>
where myfn:getmessagetext
function defined this:
public static string getmessagetext(message message, locale locale) { return message.getmessage(locale); }
Comments
Post a Comment