Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Let's create a Client-Side validation workflow, step by step.

(info) The validate attribute is set to true.

(info) Some themes do not support client-side validation.

Step 1

Create the form.

Wiki Markup
{snippet:id=clientValidation|lang=xml|javadoc=false|url=action2/apps/showcase/src/main/webapp/validation/quiz-client.jsp}

(info) This case uses the default xhtml theme, so the <saf:head > tag is used to link a style sheet.

Step 2

Create the Action class.

Wiki Markup
{snippet:id=quizAction|javadoc=false|lang=java|url=action2/apps/showcase/src/main/java/org/apache/struts/action2/showcase/validation/QuizAction.java}

Step 3

Create the validation.xml to configure the validators to be used.

Wiki Markup
{snippet:id=quizValidators|javadoc=false|lang=xml|url=action2/apps/showcase/src/main/java/org/apache/struts/action2/showcase/validation/QuizAction-validation.xml}