Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • 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
  • 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
  • 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
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!