Seeing that you have set the validate attribute to true in struts-config.xml, 
you don't even need the validate method in the form.

As far as I know, that is the only difference in using ValidationActionForm and 
ValidatorForm. However, I used the ValidatorActionForm as I had a need to do 
that. In your case, I would advise to investigate further and try to get things 
done with ValidatorForm as this means that there is DEFINITELY something wrong 
somewhere which might cause problems later.

If you do decide to go with ValidatorActionForm, yes, you just need the 
getter/setter methods and nothing else. 

One thing you must remember is that ValidatorActionForm is available in the 
struts package in Struts 1.2.8. But from Struts 1.3, its available under a 
separate package called "struts extras". So, if you will be moving from 1.2.8 
to 1.3, this is something you must consider.

Harsh.

-----Original Message-----
From: josh t [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 12, 2006 4:06 PM
To: Struts Users Mailing List
Subject: RE: extending ValidationForm instead of ValidatorActionForm


So are you saying that the only thing that changes when you switch from 
extending ValidationForm to ValidatorActionForm  is the value in  <form 
name="action vs. form"> ?  Do I need to be implementing any other methos in my 
Form, or is what I have enough? 


"Chaudhary, Harsh" <[EMAIL PROTECTED]> wrote:  My first thought was that you 
might be using an action as you validation
key i.e., in validation.xml, instead of:

  

you had:



But this is not the case. So, I can't really tell why this is happening.

Harsh.

-----Original Message-----
From: josh t [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 12, 2006 3:47 PM
To: Struts Users Mailing List
Subject: RE: extending ValidationForm instead of ValidatorActionForm


Sure. Here is the relevent section of my validation.xml and
struts-config.xml. Note that this error only happens when I use
ValidationForm. And I have no clue what that excpetion is! Any
thoughts?

>From struts-config.xml

type="com.pac.its.action.form.LoginForm"/>

type="com.pac.its.action.security.LoginAction"
name="loginForm" 
scope="request" 
validate="true"
input="/WEB-INF/pages/login.jsp">





>From Validation.xml:








My Validator-rule.xml




classname="org.apache.struts.validator.FieldChecks" 
method="validateRequired"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
javax.servlet.http.HttpServletRequest"
msg="errors.required"/>







"Chaudhary, Harsh" wrote:
Could you also include of you validation.xml and struts-config.xml?

Harsh.

-----Original Message-----
From: josh t [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 12, 2006 2:38 PM
To: user@struts.apache.org
Subject: extending ValidationForm instead of ValidatorActionForm


When my form extends Strut's ValidationForm instead of
ValidatorActionForm, I get the following exception when my form gets
loaded for the first time. Any idea what this is? Also, I've copied my
sample form here. Please let me know what I'm doing wrong. Many Thanks!

MY Form (Do I need the validate method here? ):


import javax.servlet.http.HttpServletRequest; 
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.ValidatorForm; 

public class LoginForm extends ValidatorForm {

private String password;

public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}

public ActionErrors validate(ActionMapping mapping,
HttpServletRequest 
request) {
return super.validate(mapping, request);

}

}

Exception is: 
2006-05-12 11:39:12,129 [HttpRequestHandler-1635615] ERROR
org.apache.struts.validator.ValidatorForm.validate - org.apache.s
truts.validator.FieldChecks.validateRequired(java.lang.Object,
org.apache.commons.validator.ValidatorAction, org.apache.commo
ns.validator.Field, org.apache.struts.action.ActionMessages,
javax.servlet.http.HttpServletRequest)
org.apache.commons.validator.ValidatorException:
org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Objec
t, o
rg.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages, jav
ax.servlet.http.HttpServletRequest)
at
org.apache.commons.validator.ValidatorAction.loadValidationMethod(Valida
torAction.java:627)
at
org.apache.commons.validator.ValidatorAction.executeValidationMethod(Val
idatorAction.java:557)
at
org.apache.commons.validator.Field.validateForRule(Field.java:811)
at org.apache.commons.validator.Field.validate(Field.java:890)
at org.apache.commons.validator.Form.validate(Form.java:174)
at
org.apache.commons.validator.Validator.validate(Validator.java:367)
at
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:11
0)
at
com.raytheon.its.action.form.LoginForm.validate(LoginForm.java:37)
at
org.apache.struts.action.RequestProcessor.processValidate(RequestProcess
or.java:927)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
204)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestD
ispatcher.java:765)
at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Servle
tRequestDispatcher.java:317)
at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHa
ndler.java:790)
at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:
270)
at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:
112)
at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Releasab
leResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:536)




---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and
save big.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great
rates starting at 1ยข/min.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



                        
---------------------------------
Yahoo! Mail goes everywhere you do.  Get it on your phone.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to