Back Forum Reply New

single formBackingObject() call

Hi!

i have one SimpleFormController. on the first request, i fill my command object, and show the formView.. but on every submit the formBackingObject() method is called before the onSubmit() method, and i dont want it to happen... any idea would be appreciated ... thks!

Did you try setting sessionForm to true?


Code:
lt;bean id=quot;curQuerryPopUpControllerquot; class=quot;com.db.jdare.src.control.CurQuerryPopUpControllerquot;gt;
lt;property name=quot;sessionFormquot;gt;lt;valuegt;truelt;/valuegt;lt;/propertygt;
lt;property name=quot;commandNamequot;gt;lt;valuegt;currencyDTOlt;/valuegt;lt;/propertygt;
lt;property name=quot;commandClassquot;gt;lt;valuegt;com.db.jdare.src.dto.PageableDareDTOlt;/valuegt;lt;/propertygt;
lt;property name=quot;formViewquot;gt;lt;valuegt;fxRate/CurQuerryPopUplt;/valuegt;lt;/propertygt;
lt;property name=quot;successViewquot;gt;lt;valuegt;CurQuerryPopUp.htmllt;/valuegt;lt;/propertygt;
lt;property name=quot;curServicequot;gt;lt;ref bean=quot;curServicequot;/gt;lt;/propertygt;
lt;/beangt;huuumm... intresting...
as u have seen this is some pageble form... what is happening:
1) on the first page request, formBackingObject() method is called... nice
2) [INFO] navigating buttons are submit type inputs
3) first navigating request (for example quot;Next Pagequot;) only the onSubmit() is called, great...
4) but all next submits call both formBackingObject() and onSubmit() methods...wtf??
smbd, any idea? thks!!

Shouldn't you be using AbstractWizardFormController instead of SFC if you have tabbed pages?  AWFC has a page flow process customized for wizard use, quite different from SFC's form handling process.

Glen


Originally Posted by gmazzaShouldn't you be using AbstractWizardFormController instead of SFC if you have tabbed pages?  AWFC has a page flow process customized for wizard use, quite different from SFC's form handling process.
Glen

probably... i havent used because i have never used AWFC before, have no idea how it works, but ill try now, but what is happening with SFC?

Just speculating - it could be because all the subsequent quot;nextquot; submissions don't go through the quot;new formquot; phase, so there isn't any form object saved in session. In that case my impression is formBackingObject() would still be called.

what do u mean by quot;new formquot; phase?
as gmazza said in other thread, SessionForm does not save the backing object in the session permanently. It only saves it in the session between the initial view of the form and its submission before removing the object. But, then, how my onSubmit() still detect command Object? where it is stored, if not in session?

my workflow ( on the next quot;nextsquot; ) seems to be:
1) handleInvalidSubmit(), because there is no command object (?how?) in the session;
2) formBackingObject() (is called by default quot;1)quot; i think...) create new command object :-/
3) onSubmit() here i can work normally with my command object (?why it wasnt detected in the handleInvalidSubmit() ?), but there is another, unnecessary, command object created by formBackingObject()  stored somewhere (?session?)


Originally Posted by orussoprobably... i havent used because i have never used AWFC before, have no idea how it works

AWFC is all of 20% more difficult than SFC.  Basically, instead of onSubmit(), you have processFinish(), with the same arguments, and you just need to code a few hidden variables in your JSP's to indicate the ordering of the pages.  

Validation is mostly the same between SFC and AWFC.  AWFC validates each page, one-by-one as the user progresses through them, and also validates all the pages again at the end.

Note that AWFC is for strict 1-gt;2-gt;3-gt;4 page progression, with no skipping pages or looping based on business logic.  Spring Web Flow is for that.

Glen

Hello Glen

I have main page (first page) with two buttons

From this main page, if I click a button, it goes to a page (second page). I can click quot;backquot;, it will go back to the first page.

From main page if I click another button, it goes to another page (third page). I can click quot;backquot;, it will go back to the first page.

They all share one command object.
What I should do in this case? Can I use AWFC

Thanks
sho
¥
Back Forum Reply New