• Post Reply Bookmark Topic Watch Topic
  • New Topic

Struts Validator Plug-In Framework  RSS feed

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Validator Framework.In the struts-config.xml file I have :
<form-bean name="itemCheckOutForm"
type="org.apache.struts.validator.DynaValidatorForm" >
<form-property name="category" type="java.lang.String" />
<form-property name="item" type="java.lang.String" />
<form-property name="parentItem" type="java.lang.String" />
<form-property name="vendorCode" type="java.lang.String" />
<form-property name="sendDate" type="java.lang.String" />
<form-property name="quantity" type="java.lang.String" />
<form-property name="siteCode" type="java.lang.String" />
<form-property name="roomCode" type="java.lang.String" />
</form-bean>
and Validator-PlugIn is included as:
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml"/>
</plug-in>
1.)I think I donot need to write any ActionFormBean. Or should I write?

2.) Now I donot know how to get form elements values in my action class if I am using DynaValidatorForm. I mean how to call getFieldName methods in the Action Classes.
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My understanding of the DynaValidatorForm (which I don't use) is that when you define it in the struts config that NO action form bean needs to be written. I have verified this in the past.
Have you tried just calling the getFieldName methods? I would think that those methods are created by the framework and are there for your use. Just follow the bean naming methods.
[ October 13, 2003: Message edited by: Eric Sexton ]
 
Raghuveer Rawat
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric
I even tried to call getFieldName method from action. But problem is when I call this method using DynaValidatorForm object it is giving compilation error. I don't know what is the other way to call this method.
 
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What compilation error, and have you looked at the javadoc? A DynaValidatorForm is really not at all hard to use.
- Peter
 
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way u do it with dyna action forms is to call the get/set method passing in the name/name & value.
Just like collections. Look into the api
Got it.
Sahil
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!