You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Johnny Gonzalez <jo...@yahoo.es> on 2006/06/13 04:46:22 UTC

Problem updating value in InputText

Hello everybody,

I have a JSP wich has a selectOneMenu, with this code:

<h:selectOneMenu id="discountsLst"
value="#{myBean.discount}" styleClass="atexto12"
valueChangeListener="#{myBean.selectTypeDesc}" 
onchange="submit();">
													<f:selectItems
value="#{myBean.itemsDisc}"/>
												</h:selectOneMenu>

In the code of the method selectTypeDesc I have a
sentece that depending on the discount selected,
retrieves its numeric value and calls the setter for
the inputText, in order to set the new value to show
on it, so I'm using this:

 
setSelectedDiscountValue(""+discountType.getNumericValue());


The idea with the method (selectTypeDesc) in the
valueChangeListener attribute is to change what is
displayed in a InputText component that lies in front
of the selectOneMenu. The InputText is non editable

After the user makes a selection in the selectOneMenu,
the pages gets refreshed, but the new value doesn't
get printed in the InputText, what could the problem
be?


The bean is in request,  I also tried in sesion, but
the behaviour is the same. I also tried with an
immediate="true", but no change.

I also tried to set the value putting the value in the
request with: request.setAttribute("value",
"NumericValue");

then in the JSP:

<h:inputText id="tipoDesc"
value="#{requestScope.value}"				rendered="true"
styleClass="abox2"  size="5" maxlength="5"
readonly="true"/>


Still I haven't see any change, what I'm doing wrong?

Thanks a lot,

Johnny

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.yahoo.es 

Re: Problem updating value in InputText

Posted by Johnny Gonzalez <jo...@yahoo.es>.

Temporary solution.

I had to change the component from inputText to
outputText, I didn't have a solid reason to have it as
inputText because the value shouldn't be modifiable.

But, why the question stil remains: Why the componente
(inputText) doesn't show the new value in the page,
but its binding String in the bean has the right
value?

Thanks a lot,
Johnny
 --- Johnny Gonzalez <jo...@yahoo.es>
escribió:

> Hello Bruno,
> 
> Sure it all is wrapped by tags <h:form> </h:form>
> 
> When I select something in the selectOneMenu, the
> form
> gets refreshed. but there's no visual change in the
> value of the InputText in the page.
> 
> so, what do you think?
> 
> 
>  --- Bruno Aranda <br...@gmail.com> escribió:
> 
> > Have you included the <h:form> tags around your
> > code?
> > 
> > Bruno
> > 
> > On 6/13/06, Johnny Gonzalez
> > <jo...@yahoo.es> wrote:
> > > Hello everybody,
> > >
> > > I have a JSP wich has a selectOneMenu, with this
> > code:
> > >
> > > <h:selectOneMenu id="discountsLst"
> > > value="#{myBean.discount}" styleClass="atexto12"
> > > valueChangeListener="#{myBean.selectTypeDesc}"
> > > onchange="submit();">
> > >                                                 
>  
> >                                                   
>  
> > <f:selectItems
> > > value="#{myBean.itemsDisc}"/>
> > >                                                 
>  
> >                                             
> > </h:selectOneMenu>
> > >
> > > In the code of the method selectTypeDesc I have
> a
> > > sentece that depending on the discount selected,
> > > retrieves its numeric value and calls the setter
> > for
> > > the inputText, in order to set the new value to
> > show
> > > on it, so I'm using this:
> > >
> > >
> > >
> >
>
setSelectedDiscountValue(""+discountType.getNumericValue());
> > >
> > >
> > > The idea with the method (selectTypeDesc) in the
> > > valueChangeListener attribute is to change what
> is
> > > displayed in a InputText component that lies in
> > front
> > > of the selectOneMenu. The InputText is non
> > editable
> > >
> > > After the user makes a selection in the
> > selectOneMenu,
> > > the pages gets refreshed, but the new value
> > doesn't
> > > get printed in the InputText, what could the
> > problem
> > > be?
> > >
> > >
> > > The bean is in request,  I also tried in sesion,
> > but
> > > the behaviour is the same. I also tried with an
> > > immediate="true", but no change.
> > >
> > > I also tried to set the value putting the value
> in
> > the
> > > request with: request.setAttribute("value",
> > > "NumericValue");
> > >
> > > then in the JSP:
> > >
> > > <h:inputText id="tipoDesc"
> > > value="#{requestScope.value}"                   
>  
> >      rendered="true"
> > > styleClass="abox2"  size="5" maxlength="5"
> > > readonly="true"/>
> > >
> > >
> > > Still I haven't see any change, what I'm doing
> > wrong?
> > >
> > > Thanks a lot,
> > >
> > > Johnny
> > >
> > >
> __________________________________________________
> > > Correo Yahoo!
> > > Espacio para todos tus mensajes, antivirus y
> > antispam ¡gratis!
> > > Regístrate ya - http://correo.yahoo.es
> > >
> > 
> 
> 
> __________________________________________________
> Correo Yahoo!
> Espacio para todos tus mensajes, antivirus y
> antispam ¡gratis! 
> Regístrate ya - http://correo.yahoo.es 
> 


__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.yahoo.es 

Re: Problem updating value in InputText

Posted by Johnny Gonzalez <jo...@yahoo.es>.
Hello Bruno,

Sure it all is wrapped by tags <h:form> </h:form>

When I select something in the selectOneMenu, the form
gets refreshed. but there's no visual change in the
value of the InputText in the page.

so, what do you think?


 --- Bruno Aranda <br...@gmail.com> escribió:

> Have you included the <h:form> tags around your
> code?
> 
> Bruno
> 
> On 6/13/06, Johnny Gonzalez
> <jo...@yahoo.es> wrote:
> > Hello everybody,
> >
> > I have a JSP wich has a selectOneMenu, with this
> code:
> >
> > <h:selectOneMenu id="discountsLst"
> > value="#{myBean.discount}" styleClass="atexto12"
> > valueChangeListener="#{myBean.selectTypeDesc}"
> > onchange="submit();">
> >                                                   
>                                                     
> <f:selectItems
> > value="#{myBean.itemsDisc}"/>
> >                                                   
>                                             
> </h:selectOneMenu>
> >
> > In the code of the method selectTypeDesc I have a
> > sentece that depending on the discount selected,
> > retrieves its numeric value and calls the setter
> for
> > the inputText, in order to set the new value to
> show
> > on it, so I'm using this:
> >
> >
> >
>
setSelectedDiscountValue(""+discountType.getNumericValue());
> >
> >
> > The idea with the method (selectTypeDesc) in the
> > valueChangeListener attribute is to change what is
> > displayed in a InputText component that lies in
> front
> > of the selectOneMenu. The InputText is non
> editable
> >
> > After the user makes a selection in the
> selectOneMenu,
> > the pages gets refreshed, but the new value
> doesn't
> > get printed in the InputText, what could the
> problem
> > be?
> >
> >
> > The bean is in request,  I also tried in sesion,
> but
> > the behaviour is the same. I also tried with an
> > immediate="true", but no change.
> >
> > I also tried to set the value putting the value in
> the
> > request with: request.setAttribute("value",
> > "NumericValue");
> >
> > then in the JSP:
> >
> > <h:inputText id="tipoDesc"
> > value="#{requestScope.value}"                     
>      rendered="true"
> > styleClass="abox2"  size="5" maxlength="5"
> > readonly="true"/>
> >
> >
> > Still I haven't see any change, what I'm doing
> wrong?
> >
> > Thanks a lot,
> >
> > Johnny
> >
> > __________________________________________________
> > Correo Yahoo!
> > Espacio para todos tus mensajes, antivirus y
> antispam ¡gratis!
> > Regístrate ya - http://correo.yahoo.es
> >
> 


__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.yahoo.es 

Re: Problem updating value in InputText

Posted by Bruno Aranda <br...@gmail.com>.
Have you included the <h:form> tags around your code?

Bruno

On 6/13/06, Johnny Gonzalez <jo...@yahoo.es> wrote:
> Hello everybody,
>
> I have a JSP wich has a selectOneMenu, with this code:
>
> <h:selectOneMenu id="discountsLst"
> value="#{myBean.discount}" styleClass="atexto12"
> valueChangeListener="#{myBean.selectTypeDesc}"
> onchange="submit();">
>                                                                                                         <f:selectItems
> value="#{myBean.itemsDisc}"/>
>                                                                                                 </h:selectOneMenu>
>
> In the code of the method selectTypeDesc I have a
> sentece that depending on the discount selected,
> retrieves its numeric value and calls the setter for
> the inputText, in order to set the new value to show
> on it, so I'm using this:
>
>
> setSelectedDiscountValue(""+discountType.getNumericValue());
>
>
> The idea with the method (selectTypeDesc) in the
> valueChangeListener attribute is to change what is
> displayed in a InputText component that lies in front
> of the selectOneMenu. The InputText is non editable
>
> After the user makes a selection in the selectOneMenu,
> the pages gets refreshed, but the new value doesn't
> get printed in the InputText, what could the problem
> be?
>
>
> The bean is in request,  I also tried in sesion, but
> the behaviour is the same. I also tried with an
> immediate="true", but no change.
>
> I also tried to set the value putting the value in the
> request with: request.setAttribute("value",
> "NumericValue");
>
> then in the JSP:
>
> <h:inputText id="tipoDesc"
> value="#{requestScope.value}"                           rendered="true"
> styleClass="abox2"  size="5" maxlength="5"
> readonly="true"/>
>
>
> Still I haven't see any change, what I'm doing wrong?
>
> Thanks a lot,
>
> Johnny
>
> __________________________________________________
> Correo Yahoo!
> Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
> Regístrate ya - http://correo.yahoo.es
>