facebook

struts validation

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #242119 Reply

    David
    Member

    I have a struts 1.1 app that I am mostly letting myEclipse handle the configuration. I have a basic signon validation that just doesn’t seem to work right. The ActionForm is correctly adding errors such as:

    if ((userName == null) || (userName.length() < 1)) {
    errors.add(“userName”, new ActionError(“error.username.required”));
    errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(“error.username.required”));
    }

    then in the JSP I have:
    <body>
    <html:errors/>
    ….
    <td><html:errors property=”userName”/></td>
    <td><bean:message key=”message.login.text.username”/></td>
    <td><html:text property=”userName”/></td>

    But when I don’t supply the user/pass , there is no message other than :

    [ServletException in:/webpages/Login.jsp] null’

    This code is copied almost directly out of several tutorials and I just can’t see why it doesn’t work. I tried the validation.xml and that also seems broken.

    I would really appreciate any pointers anyone can offer.

    #242122

    David
    Member

    I took a look at the Tomcat log and found these interesting StackTrackes (which I have truncated for readability)

    org.apache.jasper.JasperException at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:207)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
    …..
    —– Root Cause —–
    java.lang.ClassCastException
    at org.apache.struts.taglib.html.ErrorsTag.doStartTag(ErrorsTag.java:215)
    at org.apache.jsp.Login_jsp._jspx_meth_html_errors_0(Login_jsp.java:181)
    at org.apache.jsp.Login_jsp._jspx_meth_html_html_0(Login_jsp.java:127)
    at org.apache.jsp.Login_jsp._jspService(Login_jsp.java:87)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:92)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: struts validation

You must be logged in to post in the forum log in