• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to apply different Validations in on a single formbean which is used by a single DispatchAction

 
nitin varshney
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am learning validation framework in struts 1.3. I am facing a problem while using this. Please let me know if any one knows answer.

I am having An EmployeeFormBean(This is an ActionForm for now) and an Action Class EmployeeAction (this class extends DispatchAction). I am having addEmployee.jsp and edit employee jsp
in my admin section same editEmployee.jsp, i will use in my normal user section. I need different validations on this same form bean with the help of Validation Framework.

I am read somewhere that ValidatorActionoForm Provide you the way to apply different validations on a single form bean, but there should be multiple actions because in ValidatorActionForm be define action name in place of bean name.

But in my case i have single action and single form bean so how can i apply different validations on different html form which are using same formbean.

I am badly stuck with this issue, Please Let me know if any one has done work on same situation.
 
Rajagopal Mani
Ranch Hand
Posts: 84
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to use page attribute in validation.xml. Please add hidden field with the name of page in addEmployee.jsp & editEmployee.jsp. Please refer below link which may help you for your further analysis.

Dispatch Validator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic