Re: FormProc Controller

Ted Husted <[email protected]>
Newsgroups gmane.comp.web.maverick.general
Organization Apache Software Foundation - Jakarta Project
Message-ID <[email protected]>
Thanks for replying, Aapo.

I did something similar to this, and also added a Velocity Tool to make 
FormProc easier to use. I've uploaded the first blush in the patches area.

http://sourceforge.net/tracker/index.php?func=detail&aid=807112&group_id=26951&atid=388765

Next I'm working on support for Maps and passing parameters to a 
Singleton version of the controller.

-Ted.


Aapo Laakkonen wrote:
>>Check out how to make a Controller using formproc 
>>http://sourceforge.net/projects/formproc/
> 
> 
> Make your own controller ie. AbstractValidationController that runs code
> like this:
> 
> log.info("AbstractValidationController.validate() started.");
> 
> try {
> 
>   this.getContext().getParams().remove("form");
> 
>   if (this.form != null) {
> 
>     FormManager fm = new FormManager();
>     HttpForm form = new HttpForm(this.form, null);
>     fm.configure(form);
> 
>     log.debug("Validating form.");
> 
>     this.validationResults = form.process(this.getRequest());
> 
>     if (!this.validationResults.isValid()) {
>       log.debug("Form validation failed. Returning to input.");
>       log.info("AbstractValidationController.validate() ended.");
>       return INPUT;
>     }
> 
>     log.debug("Form validated successfully. Continuing execution.");
> 
>   } else {
>     log.debug("Skipping validation. No \"form\" controller parameter was
> specified. Continuing execution.");
>   }
> 
> } catch (Exception e) {
>   log.info("AbstractValidationController.validate() failed.");
>   throw e;
> }
> 
> log.info("AbstractValidationController.validate() ended.");
> 
> Then just put parameters to controller that denote the name of the form.
> In this case the parametrer is "form". Then just extend that controller
> whenever you need automatic validation via formproc.
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> [INVALID FOOTER]
> 

-- 
Ted Husted,
   Junit in Action  - <http://www.manning.com/massol/>,
   Struts in Action - <http://husted.com/struts/book.html>,
   JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
[INVALID FOOTER]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.