myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Delbecq <de...@oma.be>
Subject Re: Reset of forms
Date Fri, 15 Sep 2006 08:02:12 GMT
using immediate=true is not possible. I will explain further what i need
to achieve
1) immediate = true does not update the backing bean, i need them to be
updated before action call
2) my action does commit some datas relative to my backing beans. This
involve changing some lists in the backing beans
3) after action is confirmed and run, i need my form to recreate all
it's components (In fact, after the action called from xxx.jsp, i need a
new form that use the layout defined in xxx.jsp)

In my current situation, after the update of backing beans and return of
action, the navigation rule does no create a new form. As a result, one
of my component keeps it's 'initialized' state and does not recreate
himself :(

This navigation to the same page is not just a matter of clearing the
form, I need to have a new form, with same design, but with different datas.

Note about the redirect: this makes me think about the redirect manager
in sandbox about which (see my other message in mailing list) i have
problems as it store in session non serializable request scope datas.
Mike Kienenberger a écrit :
> On 9/14/06, David Delbecq <delbd@oma.be> wrote:
>> Is it correct to assume a transition from xxx.jsp to the same xxx.jsp,
>> following a navigation-rule after an action creates a brand new form
>> (recreation of all components, submitted value are not linked to those
>> components)
>
> I used this "navigate-to-the-same-page" technique when I couldn't
> quickly come up with a useful "public String clear()" action method.
>
> As others have noted, your backing beans providing data must be
> request-scoped.
>
> Also, you may need to use a <redirect /> rule to thwart any
> t:saveState and messages preservation you have on the page.
>
>  <navigation-rule>
>    <description></description>
>    <from-view-id>/pages/MyPage.xhtml</from-view-id>
>    <navigation-case>
>      <from-outcome>clear</from-outcome>
>      <to-view-id>/pages/MyPage.xhtml</to-view-id>
>       <redirect />
>    </navigation-case>
>  </navigation-rule>
>
>    public String clear()
>    {
>        return "clear";
>    }
>
>                <h:commandButton
>                    value="Clear"
>                    immediate="true"
>                    action="#{yourBean.clear}">
>                </h:commandButton>


Mime
View raw message