This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Validator Bundle" Watch "Struts Validator Bundle" New topic
Author

Struts Validator Bundle

Kalichar Rangantittu
Ranch Hand

Joined: Jan 15, 2002
Posts: 240
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:


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.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Validator Bundle
 
Similar Threads
Problems with MessageResources on my validation.xml
multiple resource bundles and validation.xml on struts 1.1
UnavailableException: Cannot load a validator resource from '/WEB-INF/
Validation Framework is not working...?
???en_US.errors.required??? instead of fileds names