Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Articles
Articles_pt
CreateActions
CreateActions_de
SpringControllers_ko
ValidationAndList_pt




JSPWiki v2.2.33

[RSS]


Hide Menu

ValidationAndList


Difference between version 48 and version 47:

At line 11 changed 1 line.
* [1] Add XDoclet Validator to Person.java
* [1] Add XDoclet Validator tags to Person.java
At line 19 changed 1 line.
!!Add XDoclet Validator to Person.java [#1]
!!Add XDoclet Validator tags to Person.java [#1]
At line 22 changed 1 line.
Using XDoclet, it's much easier - we just need to add a couple of ''@struts.validator'' tags to our POJO (Person.java). Let's open it up (src/dao/**/model/Person.java) and modify your getFirstName() and getLastName() methods to resemble the following:
Using XDoclet, it's much easier - you just need to add a couple of ''@struts.validator'' tags to the Person class. Open it up (src/dao/**/model/Person.java) and modify the getFirstName() and getLastName() methods to include ''@struts.validator type="required"'' tags.
At line 27 removed 1 line.
* @return Returns the firstName.
At line 36 removed 1 line.
* @return Returns the lastName.
At line 45 changed 1 line.
I should mention that you can also add a ''msgkey'' attribute to this tag to override the default message key for this error.
You can also add a ''msgkey'' attribute to this tag to override the default message key for this error.
At line 72 changed 1 line.
To enable validation in our personForm.jsp, you'll need to make sure your personForm.jsp has the following at the bottom:
To enable client-side validation in our personForm.jsp, a javascript JSP tag and script is required at the bottom of personForm.jsp. The following should already exist (thanks to viewgen).
At line 75 changed 1 line.
dynamicJavascript="true" staticJavascript="false"/>
dynamicJavascript="true" staticJavascript="false"/>
At line 77 changed 1 line.
src="<html:rewrite page="/scripts/validator.jsp"/>"></script>}}}
src="<html:rewrite page="/scripts/validator.jsp"/>"></script>}}}
At line 81 changed 1 line.
Now that we have Validation configured for this form, whenever this form is used in an action-mapping with validate="true", these rules will be applied. In the [last tutorial|ConfiguringTiles], we added the "savePerson" action-mapping for PersonAction. The XDoclet tags for this action-mapping were:
Now that you have Validation configured for this form, whenever this form is used in an action-mapping with validate="true", these rules will be applied. In the [last tutorial|CreateActions], we added the "savePerson" action-mapping for PersonAction. The XDoclet tags for this action-mapping were:

Back to ValidationAndList, or to the Page History.