On Fri, 14 Jan 2005 10:03:55 +0800 (CST), èé å <[EMAIL PROTECTED]> wrote:
> hi, I'm new to struts and I really can't find a way to solve the proplem.
> plese help me. thank you so much.
> Here is the proplem. I have a input.jsp,a ActionForm and a Action
> public class HelloForm extends ActionForm
> {
> private String name=null;
>
> public ActionErrors validate(ActionMapping map,HttpServletRequest req)
> {
> ActionErrors err=new ActionErrors();
> if(name.length()<1||name==null)
> err.add("nouser" ,new ActionMessage("jsp.no.user"));
>
<html:errors/> expects ActionError.
So add an ActionError instead of ActionMessage or use <html:messages/>
> return err;
> }
> when name!=null &&name.lengh>1 ,everything is normal ,the Action goto the jsp
> page I expect
> but when (name.length()<1|| name==null) is true,I think it should go to the
> input.jsp,and use <html:errors> to display the AcionMessage("jsp.no.user")
> ..But the proplem comes out:
>
> java.lang.ClassCastException
> org.apache.struts.taglib.html.ErrorsTag.doStartTag(ErrorsTag.java:215)
> org.apache.jsp.input_jsp._jspx_meth_html_errors_0(input_jsp.java:349)
> org.apache.jsp.input_jsp._jspx_meth_html_html_0(input_jsp.java:133)
> org.apache.jsp.input_jsp._jspService(input_jsp.java:87)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 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.doPost(ActionServlet.java:525)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)please help me~
>
>
> ---------------------------------
> Do You Yahoo!?
> æåäçäæåèçéèåèçé
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]