Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Struts
Display ActionMessage in JSP using fmt:message
Songezo Nkukwana
Ranch Hand
Posts: 51
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How do i display a message from resource bundle using ActionMessages?
<%@ page language="java" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <table> <tr> <fmt:bundle basename="ApplicationResources"> <fmt:message key="delta.page" /> </fmt:bundle> </tr> </table>
action class
public class WelcomeAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { ActionMessages messages = new ActionMessages(); messages.add( ActionMesages.GLOBAL_MESSAGE, new ActionMessage("delta.page","Welcome !"); saveMessages(request, messages); return mapping.findForward("showWelcome"); } }
the output displays "${0}" , not the value ... ApplicationResources.properties has delta.page={0}
Songezo Nkukwana
Ranch Hand
Posts: 51
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Ok figure out something
<table class ="pageheader"> <tr> <td> <html:messages id="msg" message ="true" property="header_msg" > <bean:write name ="msg" /> </html:messages> </td> </tr> </table>
header_msg was saved in the following action
public class WelcomeAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { ActionMessages messages = new ActionMessages(); messages.add( "header_msg", new ActionMessage("delta.page", "Welcome") ); saveMessages(request, messages); return mapping.findForward("showWelcome"); } }
But now i would like to use JSTL instead of html:messages .... How do i retrieve the property header_msg using fmt:messages?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Message Resources
need a help on Struts ActionMessage
Managing message Resource Bundle struts 1.3.8
html:messages prints mystery characters
Re, Handling Error using ActionMessages
More...