You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by magdolna holitska <mh...@hotmail.com> on 2007/01/09 19:38:45 UTC
Drop down list issue when using EL
Hi all,
I have a drop down list and I am trying to set the value selectively.
Whenever I use EL in the code, the drop down list disappears and instead, it
has the appearance of an output text.
Any hints?
Thank you,
Magdolna
Here is a simple example:
<tr:selectOneChoice id="ex" label="Example" value="#{true ? 'L1' : 'L2'}">
<tr:selectItem label="L1" value="L1"/>
<tr:selectItem label="L2" value="L2"/>
<tr:selectItem label="L3" value="L3"/>
</tr:selectOneChoice>
_________________________________________________________________
Buy what you want when you want it on Sympatico / MSN Shopping
http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805
Re: Drop down list issue when using EL
Posted by magdolna holitska <mh...@hotmail.com>.
Hi Adam,
Indeed, the problem occurs when using tr:selectOneChoice or tr:inputText.
With tr:outputText there is no error, it works fine.
Here is the stack trace:
exception
javax.servlet.ServletException: /pages/Example.xhtml @16,55
value="#{myBean.myObject.myProperty.myId}": Target Unreachable, 'myProperty'
returned null
javax.faces.webapp.FacesServlet.service(FacesServlet.java:202)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:97)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:327)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:291)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:214)
org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:90)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
com.iso_ne_on.foss.ui.util.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:98)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
root cause
javax.faces.el.PropertyNotFoundException: /pages/Example.xhtml @16,55
value="#{myBean.myObject.myProperty.myId}": Target Unreachable, 'myProperty'
returned null
com.sun.facelets.el.LegacyValueBinding.isReadOnly(LegacyValueBinding.java:84)
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.EditableValueRenderer.getReadOnly(EditableValueRenderer.java:233)
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementRenderer.renderAsElement(FormElementRenderer.java:174)
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAndMessageRenderer.getLabelFor(InputLabelAndMessageRenderer.java:75)
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMessageRenderer$Label.getForId(LabelAndMessageRenderer.java:600)
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.OutputLabelRenderer.encodeAll(OutputLabelRenderer.java:84)
org.apache.myfaces.trinidad.render.CoreRenderer.delegateRenderer(CoreRenderer.java:294)
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMessageRenderer._renderLabelCell(LabelAndMessageRenderer.java:339)
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMessageRenderer.encodeAll(LabelAndMessageRenderer.java:253)
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAndMessageRenderer.encodeAll(InputLabelAndMessageRenderer.java:117)
org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:181)
org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:673)
org.apache.myfaces.trinidad.render.RenderUtils.encodeRecursive(RenderUtils.java:67)
org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:255)
org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:277)
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.renderContent(PanelPartialRootRenderer.java:70)
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.renderContent(BodyRenderer.java:134)
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.encodeAll(PanelPartialRootRenderer.java:150)
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.encodeAll(BodyRenderer.java:76)
org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:181)
org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:673)
com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:252)
com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:178)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:97)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:327)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:291)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:214)
org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:90)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
com.iso_ne_on.foss.ui.util.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:98)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
Regards,
Magdolna
>From: "Adam Winer" <aw...@gmail.com>
>Reply-To: adffaces-user@incubator.apache.org
>To: adffaces-user@incubator.apache.org
>Subject: Re: Drop down list issue when using EL
>Date: Tue, 16 Jan 2007 15:54:30 -0800
>
>Can you provide a more complete stack trace? I'm wondering
>if this is a problem with ValueBinding.isReadOnly() throwing
>an exception when ValueBinding.getValue() does not. The
>only obvious difference between h: and tr:selectOneChoice
>is that tr:selectOneChoice uses ValueBinding.isReadOnly().
>
>-- Adam
>
>
>On 1/16/07, magdolna holitska <mh...@hotmail.com> wrote:
>>Hi again,
>>
>>Here is a little example for the problem I have.
>>
>> <tr:selectOneChoice id="tr" unselectedLabel=""
>> value="#{myBean.myObject.myProperty.myId}"
>> contentStyle="width:10em">
>> <f:selectItems value="#{myBean.myProperties}"/>
>> </tr:selectOneChoice>
>>
>>If myBean.myObject.myProperty is null, I get an error in the UI:
>> javax.servlet.ServletException
>> Target Unreachable, 'myProperty ' returned null
>>
>>If I am replacing the Trinidad drop down list with regular JSF component,
>>"#{myBean.myObject.myProperty.myId}" resolves to null without a problem:
>>
>> <h:selectOneMenu id="h" label="Normal Status" unselectedLabel=""
>> value="#{myBean.myObject.myProperty.myId}"
>> contentStyle="width:10em">
>> <f:selectItems value="#{myBean.myProperties}"/>
>> </h:selectOneMenu>
>>
>>Any idea why tr:selectOneChoice creates an exception instead of resolving
>>the value to null?
>>Is there a nice workaround?
>>
>>Thank you,
>>Magdolna
>>
>>
>>
>>
>>
>>
>> >From: "magdolna holitska" <mh...@hotmail.com>
>> >Reply-To: adffaces-user@incubator.apache.org
>> >To: adffaces-user@incubator.apache.org
>> >Subject: Re: Drop down list issue when using EL
>> >Date: Wed, 10 Jan 2007 11:52:05 -0500
>> >
>> >Hi Adam,
>> >
>> >Thanks a lot for the reply.
>> >The reason I tried that is to actually do a check for null value.
>> >
>> >In my code I have something like:
>> > value="#{a.b.c}"
>> >
>> >As I understood from the EL documentation - if a.b is null, a.b.c should
>> >automatically resolve to null.
>> >
>> >However in my code, if a.b is null it fails with the error:
>> > javax.servlet.ServletException:
>> > ...
>> > Target Unreachable, 'b' returned null
>> > javax.faces.webapp.FacesServlet.service(FacesServlet.java:202)
>> >
>> >What would be the best way to get around it?
>> >Thanks again,
>> >
>> >Regards,
>> >Magdolna
>> >
>> >
>> >
>> >
>> >>From: "Adam Winer" <aw...@gmail.com>
>> >>Reply-To: adffaces-user@incubator.apache.org
>> >>To: adffaces-user@incubator.apache.org
>> >>Subject: Re: Drop down list issue when using EL
>> >>Date: Tue, 9 Jan 2007 16:19:20 -0800
>> >>
>> >>A value expression like #{true ? ... : ...} is not writable -
>> >>if you call ValueBinding.isReadOnly(), it returns true.
>> >>As a result, Trinidad automatically turns the
>> >>selectOneChoice to readOnly mode.
>> >>
>> >>For a writable EL expression, you have to just point
>> >>at a bean property.
>> >>
>> >>-- Adam
>> >>
>> >>
>> >>On 1/9/07, magdolna holitska <mh...@hotmail.com> wrote:
>> >>>Hi all,
>> >>>I have a drop down list and I am trying to set the value selectively.
>> >>>Whenever I use EL in the code, the drop down list disappears and
>>instead,
>> >>>it
>> >>>has the appearance of an output text.
>> >>>Any hints?
>> >>>
>> >>>Thank you,
>> >>>Magdolna
>> >>>
>> >>>
>> >>>Here is a simple example:
>> >>><tr:selectOneChoice id="ex" label="Example" value="#{true ? 'L1' :
>> >>>'L2'}">
>> >>> <tr:selectItem label="L1" value="L1"/>
>> >>> <tr:selectItem label="L2" value="L2"/>
>> >>> <tr:selectItem label="L3" value="L3"/>
>> >>></tr:selectOneChoice>
>> >>>
>> >>>_________________________________________________________________
>> >>>Buy what you want when you want it on Sympatico / MSN Shopping
>> >>>http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805
>> >>>
>> >>>
>> >
>> >_________________________________________________________________
>> >Your opinion matters. Please tell us what you think and be entered into
>>a
>> >draw for a grand prize of $500 or one of 20 $50 cash prizes.
>> >http://www.youthographyinsiders.com/R.aspx?a=116
>> >
>>
>>_________________________________________________________________
>>Don't waste time standing in line�try shopping online. Visit Sympatico /
>>MSN
>>Shopping today! http://shopping.sympatico.msn.ca
>>
>>
_________________________________________________________________
Buy, Load, Play. The new Sympatico / MSN Music Store works seamlessly with
Windows Media Player. Just Click PLAY.
http://musicstore.sympatico.msn.ca/content/viewer.aspx?cid=SMS_Sept192006
Re: Drop down list issue when using EL
Posted by Adam Winer <aw...@gmail.com>.
Can you provide a more complete stack trace? I'm wondering
if this is a problem with ValueBinding.isReadOnly() throwing
an exception when ValueBinding.getValue() does not. The
only obvious difference between h: and tr:selectOneChoice
is that tr:selectOneChoice uses ValueBinding.isReadOnly().
-- Adam
On 1/16/07, magdolna holitska <mh...@hotmail.com> wrote:
> Hi again,
>
> Here is a little example for the problem I have.
>
> <tr:selectOneChoice id="tr" unselectedLabel=""
> value="#{myBean.myObject.myProperty.myId}"
> contentStyle="width:10em">
> <f:selectItems value="#{myBean.myProperties}"/>
> </tr:selectOneChoice>
>
> If myBean.myObject.myProperty is null, I get an error in the UI:
> javax.servlet.ServletException
> Target Unreachable, 'myProperty ' returned null
>
> If I am replacing the Trinidad drop down list with regular JSF component,
> "#{myBean.myObject.myProperty.myId}" resolves to null without a problem:
>
> <h:selectOneMenu id="h" label="Normal Status" unselectedLabel=""
> value="#{myBean.myObject.myProperty.myId}"
> contentStyle="width:10em">
> <f:selectItems value="#{myBean.myProperties}"/>
> </h:selectOneMenu>
>
> Any idea why tr:selectOneChoice creates an exception instead of resolving
> the value to null?
> Is there a nice workaround?
>
> Thank you,
> Magdolna
>
>
>
>
>
>
> >From: "magdolna holitska" <mh...@hotmail.com>
> >Reply-To: adffaces-user@incubator.apache.org
> >To: adffaces-user@incubator.apache.org
> >Subject: Re: Drop down list issue when using EL
> >Date: Wed, 10 Jan 2007 11:52:05 -0500
> >
> >Hi Adam,
> >
> >Thanks a lot for the reply.
> >The reason I tried that is to actually do a check for null value.
> >
> >In my code I have something like:
> > value="#{a.b.c}"
> >
> >As I understood from the EL documentation - if a.b is null, a.b.c should
> >automatically resolve to null.
> >
> >However in my code, if a.b is null it fails with the error:
> > javax.servlet.ServletException:
> > ...
> > Target Unreachable, 'b' returned null
> > javax.faces.webapp.FacesServlet.service(FacesServlet.java:202)
> >
> >What would be the best way to get around it?
> >Thanks again,
> >
> >Regards,
> >Magdolna
> >
> >
> >
> >
> >>From: "Adam Winer" <aw...@gmail.com>
> >>Reply-To: adffaces-user@incubator.apache.org
> >>To: adffaces-user@incubator.apache.org
> >>Subject: Re: Drop down list issue when using EL
> >>Date: Tue, 9 Jan 2007 16:19:20 -0800
> >>
> >>A value expression like #{true ? ... : ...} is not writable -
> >>if you call ValueBinding.isReadOnly(), it returns true.
> >>As a result, Trinidad automatically turns the
> >>selectOneChoice to readOnly mode.
> >>
> >>For a writable EL expression, you have to just point
> >>at a bean property.
> >>
> >>-- Adam
> >>
> >>
> >>On 1/9/07, magdolna holitska <mh...@hotmail.com> wrote:
> >>>Hi all,
> >>>I have a drop down list and I am trying to set the value selectively.
> >>>Whenever I use EL in the code, the drop down list disappears and instead,
> >>>it
> >>>has the appearance of an output text.
> >>>Any hints?
> >>>
> >>>Thank you,
> >>>Magdolna
> >>>
> >>>
> >>>Here is a simple example:
> >>><tr:selectOneChoice id="ex" label="Example" value="#{true ? 'L1' :
> >>>'L2'}">
> >>> <tr:selectItem label="L1" value="L1"/>
> >>> <tr:selectItem label="L2" value="L2"/>
> >>> <tr:selectItem label="L3" value="L3"/>
> >>></tr:selectOneChoice>
> >>>
> >>>_________________________________________________________________
> >>>Buy what you want when you want it on Sympatico / MSN Shopping
> >>>http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805
> >>>
> >>>
> >
> >_________________________________________________________________
> >Your opinion matters. Please tell us what you think and be entered into a
> >draw for a grand prize of $500 or one of 20 $50 cash prizes.
> >http://www.youthographyinsiders.com/R.aspx?a=116
> >
>
> _________________________________________________________________
> Don't waste time standing in line—try shopping online. Visit Sympatico / MSN
> Shopping today! http://shopping.sympatico.msn.ca
>
>
Re: Drop down list issue when using EL
Posted by magdolna holitska <mh...@hotmail.com>.
Hi again,
Here is a little example for the problem I have.
<tr:selectOneChoice id="tr" unselectedLabel=""
value="#{myBean.myObject.myProperty.myId}"
contentStyle="width:10em">
<f:selectItems value="#{myBean.myProperties}"/>
</tr:selectOneChoice>
If myBean.myObject.myProperty is null, I get an error in the UI:
javax.servlet.ServletException
Target Unreachable, 'myProperty ' returned null
If I am replacing the Trinidad drop down list with regular JSF component,
"#{myBean.myObject.myProperty.myId}" resolves to null without a problem:
<h:selectOneMenu id="h" label="Normal Status" unselectedLabel=""
value="#{myBean.myObject.myProperty.myId}"
contentStyle="width:10em">
<f:selectItems value="#{myBean.myProperties}"/>
</h:selectOneMenu>
Any idea why tr:selectOneChoice creates an exception instead of resolving
the value to null?
Is there a nice workaround?
Thank you,
Magdolna
>From: "magdolna holitska" <mh...@hotmail.com>
>Reply-To: adffaces-user@incubator.apache.org
>To: adffaces-user@incubator.apache.org
>Subject: Re: Drop down list issue when using EL
>Date: Wed, 10 Jan 2007 11:52:05 -0500
>
>Hi Adam,
>
>Thanks a lot for the reply.
>The reason I tried that is to actually do a check for null value.
>
>In my code I have something like:
> value="#{a.b.c}"
>
>As I understood from the EL documentation - if a.b is null, a.b.c should
>automatically resolve to null.
>
>However in my code, if a.b is null it fails with the error:
> javax.servlet.ServletException:
> ...
> Target Unreachable, 'b' returned null
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:202)
>
>What would be the best way to get around it?
>Thanks again,
>
>Regards,
>Magdolna
>
>
>
>
>>From: "Adam Winer" <aw...@gmail.com>
>>Reply-To: adffaces-user@incubator.apache.org
>>To: adffaces-user@incubator.apache.org
>>Subject: Re: Drop down list issue when using EL
>>Date: Tue, 9 Jan 2007 16:19:20 -0800
>>
>>A value expression like #{true ? ... : ...} is not writable -
>>if you call ValueBinding.isReadOnly(), it returns true.
>>As a result, Trinidad automatically turns the
>>selectOneChoice to readOnly mode.
>>
>>For a writable EL expression, you have to just point
>>at a bean property.
>>
>>-- Adam
>>
>>
>>On 1/9/07, magdolna holitska <mh...@hotmail.com> wrote:
>>>Hi all,
>>>I have a drop down list and I am trying to set the value selectively.
>>>Whenever I use EL in the code, the drop down list disappears and instead,
>>>it
>>>has the appearance of an output text.
>>>Any hints?
>>>
>>>Thank you,
>>>Magdolna
>>>
>>>
>>>Here is a simple example:
>>><tr:selectOneChoice id="ex" label="Example" value="#{true ? 'L1' :
>>>'L2'}">
>>> <tr:selectItem label="L1" value="L1"/>
>>> <tr:selectItem label="L2" value="L2"/>
>>> <tr:selectItem label="L3" value="L3"/>
>>></tr:selectOneChoice>
>>>
>>>_________________________________________________________________
>>>Buy what you want when you want it on Sympatico / MSN Shopping
>>>http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805
>>>
>>>
>
>_________________________________________________________________
>Your opinion matters. Please tell us what you think and be entered into a
>draw for a grand prize of $500 or one of 20 $50 cash prizes.
>http://www.youthographyinsiders.com/R.aspx?a=116
>
_________________________________________________________________
Don�t waste time standing in line�try shopping online. Visit Sympatico / MSN
Shopping today! http://shopping.sympatico.msn.ca
Re: Drop down list issue when using EL
Posted by magdolna holitska <mh...@hotmail.com>.
Hi Adam,
Thanks a lot for the reply.
The reason I tried that is to actually do a check for null value.
In my code I have something like:
value="#{a.b.c}"
As I understood from the EL documentation - if a.b is null, a.b.c should
automatically resolve to null.
However in my code, if a.b is null it fails with the error:
javax.servlet.ServletException:
...
Target Unreachable, 'b' returned null
javax.faces.webapp.FacesServlet.service(FacesServlet.java:202)
What would be the best way to get around it?
Thanks again,
Regards,
Magdolna
>From: "Adam Winer" <aw...@gmail.com>
>Reply-To: adffaces-user@incubator.apache.org
>To: adffaces-user@incubator.apache.org
>Subject: Re: Drop down list issue when using EL
>Date: Tue, 9 Jan 2007 16:19:20 -0800
>
>A value expression like #{true ? ... : ...} is not writable -
>if you call ValueBinding.isReadOnly(), it returns true.
>As a result, Trinidad automatically turns the
>selectOneChoice to readOnly mode.
>
>For a writable EL expression, you have to just point
>at a bean property.
>
>-- Adam
>
>
>On 1/9/07, magdolna holitska <mh...@hotmail.com> wrote:
>>Hi all,
>>I have a drop down list and I am trying to set the value selectively.
>>Whenever I use EL in the code, the drop down list disappears and instead,
>>it
>>has the appearance of an output text.
>>Any hints?
>>
>>Thank you,
>>Magdolna
>>
>>
>>Here is a simple example:
>><tr:selectOneChoice id="ex" label="Example" value="#{true ? 'L1' : 'L2'}">
>> <tr:selectItem label="L1" value="L1"/>
>> <tr:selectItem label="L2" value="L2"/>
>> <tr:selectItem label="L3" value="L3"/>
>></tr:selectOneChoice>
>>
>>_________________________________________________________________
>>Buy what you want when you want it on Sympatico / MSN Shopping
>>http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805
>>
>>
_________________________________________________________________
Your opinion matters. Please tell us what you think and be entered into a
draw for a grand prize of $500 or one of 20 $50 cash prizes.
http://www.youthographyinsiders.com/R.aspx?a=116
Re: Drop down list issue when using EL
Posted by Adam Winer <aw...@gmail.com>.
A value expression like #{true ? ... : ...} is not writable -
if you call ValueBinding.isReadOnly(), it returns true.
As a result, Trinidad automatically turns the
selectOneChoice to readOnly mode.
For a writable EL expression, you have to just point
at a bean property.
-- Adam
On 1/9/07, magdolna holitska <mh...@hotmail.com> wrote:
> Hi all,
> I have a drop down list and I am trying to set the value selectively.
> Whenever I use EL in the code, the drop down list disappears and instead, it
> has the appearance of an output text.
> Any hints?
>
> Thank you,
> Magdolna
>
>
> Here is a simple example:
> <tr:selectOneChoice id="ex" label="Example" value="#{true ? 'L1' : 'L2'}">
> <tr:selectItem label="L1" value="L1"/>
> <tr:selectItem label="L2" value="L2"/>
> <tr:selectItem label="L3" value="L3"/>
> </tr:selectOneChoice>
>
> _________________________________________________________________
> Buy what you want when you want it on Sympatico / MSN Shopping
> http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805
>
>