RE: Maverick with validation framwork
Dan Finkelstein <[email protected]>
| Newsgroups | gmane.comp.web.maverick.general |
|---|---|
| Message-ID | <[email protected]> |
My system is built using Jakarta Validator. Looks like a similar
capability to FormProc. What I did was key off the Controller name. I
pass that name to the validating system, which then extracts from a xml
file the restrictions on this fom, such as a required field. It then calls
certain "validators", which are really short java methods which do the
actual work. These validators, should they find an error, populate
Maverick's error map with actual text also pulled from the xml
file. Later, when maverick redisplays the page, each field with an error
will have the error text displayed beside it.
Hope this gives you another perspective on a similar but different approach
! Good luck,
Dan
At 11:27 AM 4/8/2003 +0300, you wrote:
> > FormProc (from SourceForge) and Validator (from Jakarta).
> > I was curious if anyone has used a framework and what
> > your experience regarding these frameworks is.
>
>I have used FormProc. It's very easy. How I intagrated it was adding
>parameter to controller that tells the name of form.
>
><controller ...>
> <param name="form" value"login" />
></controller>
>
>And here is the integration code:
>
>try {
>
> this.getContext().getParams().remove("form");
>
> // this.form is automatically populated with BeanUtils.
> if (this.form != null) {
>
> FormManager fm = new FormManager();
> HttpForm form = new HttpForm(this.form, null);
> fm.configure(form);
>
> // this.validationResults can be used by views.
> this.validationResults =
>form.process(this.getRequest());
>
> if (!this.validationResults.isValid()) {
> log.debug("Form validation failed. Returning to
>input.");
> return INPUT;
> }
>
> }
>
>} catch (Exception e) {
> throw e;
>}
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: ValueWeb:
>Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
>No other company gives more support or power for your dedicated server
>http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
>[INVALID FOOTER]
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger
for complex code. Debugging C/C++ programs can leave you feeling lost and
disoriented. TotalView can help you find your way. Available on major UNIX
and Linux platforms. Try it free. www.etnus.com
[INVALID FOOTER]