struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From josh t <josh_got...@yahoo.com>
Subject RE: extending ValidationForm instead of ValidatorActionForm
Date Fri, 12 May 2006 21:52:17 GMT
Thanks Gary. So where should I be adding this method. I'm using struts 1.2.9. This probably
has something to do with it, as Harsh noted in his response. 

Gary VanMatre <gvanmatre@comcast.net> wrote:  It sort of looks like you are missing
a formal parameter type in the methodParams.
The "Validator", second to last param is missing. 

methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"

public static boolean validateRequired(Object bean, ValidatorAction va, Field field, ActionMessages
errors, Validator validator, HttpServletRequest request) 

Bad error message regardless....

Gary
-------------- Original message -------------- 
From: "Chaudhary, Harsh" 

> 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:josh_gotsch@yahoo.com] 
> 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:josh_gotsch@yahoo.com] 
> 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: user-unsubscribe@struts.apache.org 
> For additional commands, e-mail: user-help@struts.apache.org 
> 
> 
> 
> 
> --------------------------------- 
> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great 
> rates starting at 1¢/min. 
> 
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org 
> For additional commands, e-mail: user-help@struts.apache.org 
> 

		
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min
or less.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message