[Hippo-cms7-user] Maintain state between doAction and doRender
Mansour Al Akeel
mansour.alakeel at gmail.com
Sat May 29 07:16:32 CEST 2010
Thank you for this tip. Nice to have this for the next componenets. I
will keep this in mind, and try to utilize it.
On Tue May 25,2010 09:25 am, Ard Schrijvers wrote:
> Hello Mansour et al,
> for more advanced sharing state between action and render, which also
> seamlessly works in a clustered environment (as we use PRG pattern,
> with a client browser redirect, you do not want to maintain state in a
> http session) you can also look at the BaseFormHstComponent.
> The hst-testsuite-site has an example of this, see Contact.java
> The parameters you want to keep are temporarily stored in a map in the
> repo during action. During render, the map is read again. You can also
> build multi page forms with it, and keep all previously submitted
> We also have a validation framework for forms, which uses in the end
> the BaseFormHstcomponent, see
> http://forge.onehippo.org/projects/hstvalidation/ and
> For some reason, some of the links on the documentation do not work,
> I'll ask someone to look into it.
> Hope this helps,
> regards Ard
> On Tue, May 25, 2010 at 9:11 AM, Woonsan Ko <w.ko at onehippo.com> wrote:
> > Hi Mansour,
> > On Sun, May 23, 2010 at 3:26 PM, Mansour Al Akeel
> > <mansour.alakeel at gmail.com> wrote:
> >> Hello all:
> >> I am looking for some help and advice about the best way to perform
> >> communication and maintain state between calls to doAction and doRender.
> >> Normally after I process some action, I need to display a message to the
> >> user, indicating the results of the action. If I want to use
> >> HSTRequest.setAttribute, then It wont work from doAction, since it's
> >> meant for processing the request. Therefore, I have to set the request
> >> attributes from within doRender method. The easiest way to achieve this
> >> is to have a global variable in the HSTComponent and set it's value when
> >> processing the action (doAction).
> >> This is very similar to portlets, however, when working with portlets
> >> ActionRequest, has a method to set Render Parameters. I think this is
> >> very clean way to store the action results. Using global variables would
> >> do the job with no problem, but I try to avoid using global variable to
> >> things clean and easy to test.
> > HST-2 also provides setting render parameter in action phase.
> > You can use org.hippoecm.hst.core.component.HstResponse#setRenderParameter(key,
> > value) in doAction() method. Of course, you can retrieve the parameter
> > by HstRequest.getParameter(key) in doBeforeRender() or your render
> > page.
> >> Any comments ? Is there an example in the demosuite related to this ?
> > There's an example in demosuite: org.hippoecm.hst.demo.components.Search
> > Regards,
> > Woonsan
> >> Thank you in advance.
> >> _______________________________________________
> >> Hippo-cms7-user mailing list and forums
> >> http://www.onehippo.org/cms7/support/forums.html
> > --
> > w.ko at onehippo.com ? ? www.onehippo.com
> > EUROPE ? AMSTERDAM - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
> > NORTH AMERICA ? SAN FRANCISCO - Hippo USA Inc. 185 H Street, Suite B
> > Petaluma CA 94952 +1 (877) 414-4776
> > _______________________________________________
> > Hippo-cms7-user mailing list and forums
> > http://www.onehippo.org/cms7/support/forums.html
> Hippo-cms7-user mailing list and forums
More information about the Hippo-cms7-user