AppFuse
  1. AppFuse
  2. APF-1273

Struts2 validation using validator xml files

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.1.0
    • Fix Version/s: None
    • Component/s: Web - Struts
    • Labels:
    • Environment:
      Mac osx, firefox

      Description

      I am trying to implement validation with struts as per the example in appfuse tutorial. Created files same as Userform.jsp. The fields are getting validated on submission, but the page is showing the error as below.

      Created four files similar to User-validaton.xml and UserAction-validation.xml and placed in folders

      src/main/java/com/.../onb/webapp/action
      src/main/java/com/..../onb/action

      src/main/java/com/..../onb/model
      src/main/java/com/..../onb/webapp/com/netflix/onb/model

      Am not sure what am doing wrong here.

      ############Error shown on jsp page as below #############.

      Warning First Name is a required field.
      Warning employee.firstName=[First Name is a required field.]
      Struts Problem Report

      Struts has detected an unhandled exception:
      Messages:

      empOnboardAction
      Invalid action class configuration that references an unknown class named [empOnboardAction]

      File: org/codehaus/plexus/classworlds/strategy/SelfFirstStrategy.java
      Line number: 50
      Stacktraces
      java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [empOnboardAction]

      org.apache.struts2.convention.ConventionsServiceImpl.determineResultPath(ConventionsServiceImpl.java:100)
      org.apache.struts2.convention.ConventionUnknownHandler.determinePath(ConventionUnknownHandler.java:385)
      org.apache.struts2.convention.ConventionUnknownHandler.handleUnknownResult(ConventionUnknownHandler.java:274)
      com.opensymphony.xwork2.DefaultUnknownHandlerManager.handleUnknownResult(DefaultUnknownHandlerManage

        Activity

        Hide
        Satya added a comment -

        Resolved this issue. My bad, I wasn't aware that I need to mention the input result type for the action. Now only problem I have is the validation message at top of the page is being showed twice. I tried switching non dev mode, but still it appears twice as below

        Warning First Name is a required field.
        Warning employee.firstName=[First Name is a required field.]

        Show
        Satya added a comment - Resolved this issue. My bad, I wasn't aware that I need to mention the input result type for the action. Now only problem I have is the validation message at top of the page is being showed twice. I tried switching non dev mode, but still it appears twice as below Warning First Name is a required field. Warning employee.firstName= [First Name is a required field.]

          People

          • Assignee:
            Matt Raible
            Reporter:
            Satya
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development