• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Validator Bundle

 
Kalichar Rangantittu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using struts-1.2.9.jar. In my validation.xml, I have the following:

I have there resource called "web" mapped out in my struts-config.xml as :


When I try to access my page, the validator fails to find the bundle with the stack trace shown below. Why is my validator tag not picking up the resource file. It works great otherwise if I comment out the validator code.

Thanks in advance for any suggestions.


javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
at org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1189)
at org.apache.struts.taglib.html.JavascriptValidatorTag.createDynamicJavascript(JavascriptValidatorTag.java:433)
at org.apache.struts.taglib.html.JavascriptValidatorTag.renderJavascript(JavascriptValidatorTag.java:393)
at org.apache.struts.taglib.html.JavascriptValidatorTag.doStartTag(JavascriptValidatorTag.java:349)
at org.apache.jsp.WEB_002dINF.pages.login_jsp._jspx_meth_html_javascript_0(org.apache.jsp.WEB_002dINF.pages.login_jsp:509)
at org.apache.jsp.WEB_002dINF.pages.login_jsp._jspx_meth_html_form_0(org.apache.jsp.WEB_002dINF.pages.login_jsp:331)
at org.apache.jsp.WEB_002dINF.pages.login_jsp._jspx_meth_html_html_0(org.apache.jsp.WEB_002dINF.pages.login_jsp:226)
at org.apache.jsp.WEB_002dINF.pages.login_jsp._jspService(org.apache.jsp.WEB_002dINF.pages.login_jsp:113)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
 
Durgaprasad Guduguntla
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have also faced the same problem. There is a bug in struts validator not recognizing bundle attribute. Look at the following link.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The entries in your struts-config.xml file are incorrect. Remove the second entry:

<message-resources key="web" parameter="com.test.resource.ApplicationResources_en_US" />

This entry is intended to point to a resource bundle, which could consist of any number of language-specific files. It's not intended to point to individual files.

Therefore, your first entry:

<message-resources key="web" parameter="com.test.resource.ApplicationResources" />

should be sufficient.

Unless you're planning to have more than one resource bundle, I'd suggest removing the key attribute. That way you don't have to specify a bundle name every time you use a message.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic