This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes How to apply different Validations in on a single formbean which is used by a single DispatchAction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to apply different Validations in on a single formbean which is used by a single DispatchAction" Watch "How to apply different Validations in on a single formbean which is used by a single DispatchAction" New topic
Author

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

nitin varshney
Greenhorn

Joined: Sep 17, 2008
Posts: 10
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

Joined: Mar 24, 2011
Posts: 84

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to apply different Validations in on a single formbean which is used by a single DispatchAction
 
Similar Threads
ValidatorActionForm Question?
DispatchAction and Validator
validation with dispatch action
Dispatch Action and Multiple form beans
Different Types of Form beans in struts