myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emily Gu <e20...@gmail.com>
Subject Re: Submit and h:commandLink question
Date Mon, 19 Dec 2005 05:32:09 GMT
Yeah, that was it. Thank you very much!!

One more question, if I put that SelectOneRadio template into an include
file as
<f:view>
  <h:form>
       <%@ include file="myTemp.jspf" %>
       <h:commandLink immediate="false" action="#{choice.createEntry} ">
            <h:outputText value="Create" />
        </h:commandLink>
  </h:form>
</f:view>

Since it will be reused over several pages. The CommandLink has no effect to
it. That is no matter what I change in selection, it never reflect in
backing bean. Only when I remove the include file, put it into the form
directly, everything worked as expected.

Thanks!!


On 12/18/05, Simon Kitching <skitching@obsidium.com> wrote:
>
> Hi,
>
> The h:commandLink is immediate. That means that it is *completely*
> processed before the h:selectOneRadio component gets processed at all.
>
> So you won't see any updated model values in the actionListener method
> associated with the commandLink. In fact, as the commandLink always does
> navigation to the action destination, the radio value will *never* get
> pushed into the model.
>
> If you want to validate your components and push them into the model
> before doing any navigation, set immediate to false.
>
> Regards,
>
> Simon
>
> Emily Gu wrote:
> > Sorry, that was a typo. It is a setter method. Do you see anything else
> > wrong?
> >
> > Thanks!!
> >
> >
> > On 12/18/05, *Simon Kitching* <skitching@obsidium.com
> > <mailto:skitching@obsidium.com>> wrote:
> >
> >     Emily Gu wrote:
> >      > Here is my code:
> >      >
> >      > jsp page:
> >      >
> >      > <f:view>
> >      >    <h:form>
> >      >        <h:selectOneRadio value=" #{choice.choiceEntry}">
> >      >           <f:selectItems value="#{choiceList.choiceMap} "/>
> >      >       </h:selectOneRadio>
> >      >
> >      >       <h:commandLink immediate= "true" value="Create"
> >      > action="#{choice.createEntry} " />
> >      >
> >      >    </h:form>
> >      > </f:view>
> >      >
> >      > Bean:
> >      >
> >      > public class Choice {
> >      >    private String choiceEntry;
> >      >
> >      >    public Choice () { }
> >      >    public void getChoiceEntry () { return choiceEntry;}
> >      >    public String getChoiceEntry (String e) ( choiceEntry = e;}
> >      >
> >      >    public void createEntry () { System.out.println (choiceEntry);
> }
> >      > }
> >      >
> >      > In the createEntry method, I just want to see the value of
> changed
> >      > choices. It is always null. The initial value is null, that is
> >     fine, why
> >      > after I made selection, then click the "Create" command link,
> >      > the returned page had correctly remembered the selection, but the
> >      > console printout is null all the time. Thanks for your help.
> >
> >     Is this really what's in your code:
> >      >    public String getChoiceEntry (String e) ( choiceEntry = e;}
> >
> >     If so, that would explain your problem: no setter method.
> >
> >     Cheers,
> >
> >     Simon
> >
> >
>
>

Mime
View raw message