[Opensource] ActionForms and Validation
Mike Traum
mtraum at jgroup.net
Thu Jan 15 10:22:27 PST 2004
ControllerForm extends ActionForm, so you can extend that. Then you
define that in struts-config.xml <form-beans/> and in the 'name'
parameter of the action mapping. To validate, I believe you override the
validate(ActionMapping mapping, HttpServletRequest request) method of
ActionForm. Also, I believe you should use State.perform instead of
State.run so that you'll have access to that form bean from the state.
You can also use Expresso methods, such as State.addParameter(String
newParam, boolean required, String mask, String maskError). See
SimpleLoginController.java for an example of this.
Or, there's State.setMask() & State.checkParamMasks(). Or,
State.autoValidate() to validate data based on a DBObject definition.
request.getParameter("name") is generally how you get a parameter in
expresso. It's getting it from the ControllerRequest. If you use a
custom ControllerForm, you'll want to use the form bean.
hth,
mike
On Thu, 2004-01-15 at 09:14, Raul DAVIDOVICH wrote:
> Hi all,
>
> I'm trying to implement form validation in expresso.
>
> In struts, one just needs to extend ValidatorForm instead of ActionForm and
> the job is done.. but in expresso I'm having a real hard time to find out
> how and where action forms are implemented so I can add this.
>
> Up to now I've been using request.getParameter("paramName") for retrieving
> the fields from the page, and now that I look further I cannott find them
> beeing mapped to an actionform anywhere.
>
> I did see that there are some methods in the controller for retrieving the
> form from the request, but it's empty.
>
>
>
> if anyone can point me to where I can start looking it would be very
> helpful.
>
>
> Thanks in advance
>
> Best regards,
>
> ---------------------------------------------------
> Raul Davidovich
> Responsable Informatique
> Cvitkovic & Associés Consultants
>
> (33) 1 45 15 40 68
> (33) 1 45 15 40 41 Fax
> -------------------------------------------------------
> http://www.caconcology.com
>
>
> _______________________________________________
> Opensource mailing list
> Opensource at jcorporate.com
> http://mail.jcorporate.com/mailman/listinfo/opensource
> Archives: http://mail.jcorporate.com/pipermail/opensource/
--
Mike Traum
--
JGroup Expert
Expresso Core Developer
Providing support and development services - Available Now!
More information about the Opensource
mailing list