You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jerry Jalenak <Je...@LABONE.com> on 2004/01/22 22:15:04 UTC

[Validator] Custom Validator Fails to Return to JSP

I've used the 'comparing two fields' example from Validator for a while now
without any problem.  When I brought down the 20040106 nightly build, I
noticed that several methods had been deprecated, so I dutifully changed
things over:

From:

	public static boolean comparePasswords(Object _object,
ValidatorAction _va, Field _field, ActionErrors _errors, HttpServletRequest
_request)
	
	_errors.add(_field.getKey(), Resources.getActionError(_request, _va,
_field));

To:
	public static boolean comparePasswords(Object _object,
ValidatorAction _va, Field _field, ActionMessages _messages,
HttpServletRequest _request)

	_messages.add(_field.getKey(), Resources.getActionMessage(_request,
_va, _field));

If I continue to use the 'From' form (with ActionErrors), I get NPE's on the
_errors.add; if I use the 'To' form, everything seems to work but I don't go
back to my JSP; rather, it appears to be returning null as I end up with a
blank page.

Also, before anyone asks, I do change the validator.xml to the appropriate
methodParms:

From:

	<validator name="comparePasswords" 
		classname="com.lbo.ms.v3.struts.extensions.Validator"
		method="comparePasswords" 
		methodParams="java.lang.Object,
	
org.apache.commons.validator.ValidatorAction,
				org.apache.commons.validator.Field,
				org.apache.struts.action.ActionErrors,
				javax.servlet.http.HttpServletRequest"
		msg="errors.compare.passwords" />

To:

	<validator name="comparePasswords" 
		classname="com.lbo.ms.v3.struts.extensions.Validator"
		method="comparePasswords" 
		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.compare.passwords" />

I can't seem to find a bug report on this, and there doesn't seem to be much
more information on the changes on the website.  Can someone shed some light
on this?

Thanks!


PS - I would go grab a more current nightly build, but it appears that the
nightlies are failing. Has anyone looked at this?

Jerry Jalenak
Development Manager, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496

jerry.jalenak@labone.com


This transmission (and any information attached to it) may be confidential and
is intended solely for the use of the individual or entity to which it is
addressed. If you are not the intended recipient or the person responsible for
delivering the transmission to the intended recipient, be advised that you
have received this transmission in error and that any use, dissemination,
forwarding, printing, or copying of this information is strictly prohibited.
If you have received this transmission in error, please immediately notify
LabOne at the following email address: securityincidentreporting@labone.com


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org