File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Action Message error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Action Message error" Watch "Action Message error" New topic
Author

Action Message error

Rochal Collins
Greenhorn

Joined: Jul 31, 2007
Posts: 15
I'm getting errors when I try to validate my application.

Here's my struts-config:

<action-mappings>
<action
path="/viewresume"
type="com.struts.resumeonline.SearchAction"
input="/viewresume.jsp"
name="searchForm"
scope="request"
validate="true">
<forward name="success" path="/viewresume" redirect="true" />

</action>
</action-mappings>

form:

public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request)
{
ActionErrors errors = new ActionErrors();
if (getEmail() == null || getEmail().length() < 1) {
errors.add("email", new ActionMessage("error.Search.email.missing"));
}
if (getPassword() == null || getPassword().length() < 1) {
errors.add("password", new ActionMessage("error.Search.password.missing"));
}

return errors;
}
applicationresources file:

# Resources for parameter 'com.struts.resumeonline.ApplicationResources'
# Project ResumeOnline
# Label Resouces
label.Search.email=Email
label.Search.password=Password


#Error Resources
error.Search.criteria.missing=Search Criteria Missing
error.Search.email.missing=Email Missing
errors.header=<font color="red"><cTypeface:Bold>Validation Error(s)</b></font><ul>
error.footer=</ul><hr width="100%" size="1" noshade="true">
errors.prefix=<li>
errors.suffix=</li>


Here's the errors:

org.apache.jasper.JasperException: org.apache.struts.action.ActionMessage
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:476)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:389)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012)
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

java.lang.ClassCastException: org.apache.struts.action.ActionMessage
org.apache.struts.taglib.html.ErrorsTag.doStartTag(ErrorsTag.java:215)
org.apache.jsp.viewresume_jsp._jspx_meth_html_005ferrors_005f0(viewresume_jsp.java:357)
org.apache.jsp.viewresume_jsp._jspService(viewresume_jsp.java:106)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012)
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

What am I doing wrong?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The only thing I can suggest would be to make sure that all jar files in your WEB-INF/lib file come from the download for the same version of Struts -- no mixing and matching from different versions. If you're using Struts 1.3.x, make sure you remove all TLD files and use the new namespace references rather than the old type. For example, this should be your taglib definition for html tags:


Merrill
Consultant, Sima Solutions
Rochal Collins
Greenhorn

Joined: Jul 31, 2007
Posts: 15
Thanks Merill. I figured it out early this morning. That was the problem!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Action Message error
 
Similar Threads
java.lang.ClassCastException: org.apache.struts.action.ActionMessage cannot be cast to org.apache.st
validation message
org.apache.jasper.JasperException
Probelom in Manual Validation method
Missing message for key "app.title"