File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts Validator Bundle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Validator Bundle" Watch "Struts Validator Bundle" New topic

Struts Validator Bundle

Kalichar Rangantittu
Ranch Hand

Joined: Jan 15, 2002
Posts: 240

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(
at org.apache.struts.taglib.html.JavascriptValidatorTag.createDynamicJavascript(
at org.apache.struts.taglib.html.JavascriptValidatorTag.renderJavascript(
at org.apache.struts.taglib.html.JavascriptValidatorTag.doStartTag(
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(
at javax.servlet.http.HttpServlet.service(
at org.apache.jasper.servlet.JspServletWrapper.service(
at org.apache.jasper.servlet.JspServlet.serviceJspFile(
at org.apache.jasper.servlet.JspServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(

Never be satisfied with anything less than the best and you will surely pass the test...
Durgaprasad Guduguntla
Ranch Hand

Joined: Oct 20, 2003
Posts: 99
I have also faced the same problem. There is a bug in struts validator not recognizing bundle attribute. Look at the following link.

Thanks,<br />Durgaprasad<br />SCJP1.4, SCWCD1.4, SCBCD1.3,<br />SCEA
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Struts Validator Bundle
It's not a secret anymore!