You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jose Gonzalez Gomez <jg...@hydriads.com> on 2002/12/16 18:41:27 UTC
html:messages not working
Hello,
I'm trying to use html:messages, with no success. The curious thing
about this is I have a working html:errors tag in the same page. I get
the following exception when showing my jsp:
[ServletException in:/pages/admin/supplier/list.jsp] Cannot find message
resources under key org.apache.struts.action.MESSAGE'
javax.servlet.jsp.JspException: Cannot find message resources under key
org.apache.struts.action.MESSAGE at
org.apache.struts.util.RequestUtils.message(RequestUtils.java:807) at
org.apache.struts.taglib.html.MessagesTag.doStartTag(MessagesTag.java:246)
at
org.apache.strutsel.taglib.html.ELMessagesTag.doStartTag(ELMessagesTag.java:93)
at org.apache.jsp.list$jsp._jspService(list$jsp.java:116) at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201).......
Here is my jsp source code (I'm using JSTL in addition to Struts
tags, and EL version of Struts tags):
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el"
prefix="html" %>
<fmt:setBundle basename="admin.messages" />
<table border="1" width="70%" align="center">
<c:if test="${not empty
requestScope['org.apache.struts.action.ACTION_MESSAGE']}">
<tr><td class="textMessage"><html:messages id="message"
message="true" ><c:out value="${message}" /></html:messages></td></tr>
</c:if>
<c:if test="${not empty
requestScope['org.apache.struts.action.ERROR']}"><tr><td
class="textError"><html:errors /></td></tr></c:if>
....
Here is my java source code:
....
ActionMessages messages = new ActionMessages( );
messages.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
"supplier.modified" ) );
this.saveMessages( httpServletRequest, messages );
....
web.xml:
<servlet>
<servlet-name>action</servlet-name>
<display-name>strutsAction</display-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<!-- Struts module configuration -->
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/config/struts.xml</param-value>
</init-param>
<init-param>
<param-name>config/admin</param-name>
<param-value>/WEB-INF/config/admin/struts.xml</param-value>
</init-param>
/WEB-INF/config/admin/struts.xml: (No message resources defined in
main struts configuration file)
<message-resources parameter="admin.messages" null="false"/>
As I said before, the html:errors tag works like a charm, but I get
the above exception when trying to use html:messages... any idea?
Thanks
Jose
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>