You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by JavaRunner <ra...@bellsouth.net> on 2009/04/03 21:31:16 UTC

JSF EL Problem

Can anyone solve this? 
I have an expression that looks like this:
#{backingBean.someproperty[linkBean.arg1]} which causes an EL parsing error. 
I've tried some variations such as:
#{backingBean.someproperty[#{linkBean.arg1}]} and 
#{backingBean[linkBean.arg1].someproperty}. These cause parsing errors also. 
I've verified that both backingBean.someproperty and linkBean.arg1 have
valid values. 
These expressions in part implement a link as in <h:commandLink... on a
master list which grabs the current datatable row and renders the row
details on the next page - or at least it's supposed to! 
What am i missing here? 
Help appreciated. 


-- 
View this message in context: http://www.nabble.com/JSF-EL-Problem-tp22874219p22874219.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: JSF EL Problem

Posted by Andrew Robinson <an...@gmail.com>.
#{backingBean.someproperty[linkBean.arg1]} basically means:

BackingBean bean = (BackingBean)elExpr.getValue();
Object someProperty = bean.getSomeproperty();
LinkBean linkBean = (LinkBean)elExpr.getValue();
Object someArg = linkBean.getArg1();

return someProperty.get(someArg);


So I have no idea why you are trying to do "String[Integer]". EL
doesn't support returning characters in a string by index. What are
you trying to do?

Best thing is to give us a little of your JSPX code and then tell us
what you want. EL is no different than Java except the syntax is
different, it isn't magic. So figure out what you want to call, then
strip out the beginning get from properties and use [] to get items
from a Map by key or items in a list by index.

-Andrew

On Fri, Apr 3, 2009 at 5:02 PM, Andrew Robinson
<an...@gmail.com> wrote:
> #{backingBean.someproperty[linkBean.arg1]} is correct syntax, assuming
> that backingBean.someproperty is a map or list or other java object
> and not a primitive or something that the [] cannot be applied to.
> What is the signature of the getSomeProperty method on backingBean and
> the getArg1 on the linkBean?
>
> Is the error on evaluating a get or set of the EL?
>
> -Andrew
>
> On Fri, Apr 3, 2009 at 1:31 PM, JavaRunner <ra...@bellsouth.net> wrote:
>>
>> Can anyone solve this?
>> I have an expression that looks like this:
>> #{backingBean.someproperty[linkBean.arg1]} which causes an EL parsing error.
>> I've tried some variations such as:
>> #{backingBean.someproperty[#{linkBean.arg1}]} and
>> #{backingBean[linkBean.arg1].someproperty}. These cause parsing errors also.
>> I've verified that both backingBean.someproperty and linkBean.arg1 have
>> valid values.
>> These expressions in part implement a link as in <h:commandLink... on a
>> master list which grabs the current datatable row and renders the row
>> details on the next page - or at least it's supposed to!
>> What am i missing here?
>> Help appreciated.
>>
>>
>> --
>> View this message in context: http://www.nabble.com/JSF-EL-Problem-tp22874219p22874219.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
>

Re: JSF EL Problem

Posted by Rafa PĂ©rez <ra...@gmail.com>.
It seems like getMemberSSN() returns neither a Map nor a List but a String.
And you are trying to access the value '10' inside that String...

HTH,

-- Rafa


On Sat, Apr 4, 2009 at 3:01 AM, JavaRunner <ra...@bellsouth.net>wrote:

>
> Well, I tried that and this is what I
> got:org.apache.jasper.el.JspPropertyNotFoundException -
> /app/patientdetail.jsp(60,18)
> '#{memberBackingBean.memberSSN[linkBean.arg1]}' Property '10' not found on
> type java.lang.String
>
> arg1 is declared as Integer and has corresponding getter and setter.  Also,
> '10' is the correct value of the selected primary key.
> I must be missing something very basic.
>
> Andrew Robinson-5 wrote:
> >
> > #{backingBean.someproperty[linkBean.arg1]} is correct syntax, assuming
> > that backingBean.someproperty is a map or list or other java object
> > and not a primitive or something that the [] cannot be applied to.
> > What is the signature of the getSomeProperty method on backingBean and
> > the getArg1 on the linkBean?
> >
> > Is the error on evaluating a get or set of the EL?
> >
> > -Andrew
> >
> > On Fri, Apr 3, 2009 at 1:31 PM, JavaRunner <ra...@bellsouth.net>
> > wrote:
> >>
> >> Can anyone solve this?
> >> I have an expression that looks like this:
> >> #{backingBean.someproperty[linkBean.arg1]} which causes an EL parsing
> >> error.
> >> I've tried some variations such as:
> >> #{backingBean.someproperty[#{linkBean.arg1}]} and
> >> #{backingBean[linkBean.arg1].someproperty}. These cause parsing errors
> >> also.
> >> I've verified that both backingBean.someproperty and linkBean.arg1 have
> >> valid values.
> >> These expressions in part implement a link as in <h:commandLink... on a
> >> master list which grabs the current datatable row and renders the row
> >> details on the next page - or at least it's supposed to!
> >> What am i missing here?
> >> Help appreciated.
> >>
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/JSF-EL-Problem-tp22874219p22874219.html
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/JSF-EL-Problem-tp22874219p22878863.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: JSF EL Problem

Posted by JavaRunner <ra...@bellsouth.net>.
Well, I tried that and this is what I
got:org.apache.jasper.el.JspPropertyNotFoundException -
/app/patientdetail.jsp(60,18)
'#{memberBackingBean.memberSSN[linkBean.arg1]}' Property '10' not found on
type java.lang.String

arg1 is declared as Integer and has corresponding getter and setter.  Also,
'10' is the correct value of the selected primary key.
I must be missing something very basic.

Andrew Robinson-5 wrote:
> 
> #{backingBean.someproperty[linkBean.arg1]} is correct syntax, assuming
> that backingBean.someproperty is a map or list or other java object
> and not a primitive or something that the [] cannot be applied to.
> What is the signature of the getSomeProperty method on backingBean and
> the getArg1 on the linkBean?
> 
> Is the error on evaluating a get or set of the EL?
> 
> -Andrew
> 
> On Fri, Apr 3, 2009 at 1:31 PM, JavaRunner <ra...@bellsouth.net>
> wrote:
>>
>> Can anyone solve this?
>> I have an expression that looks like this:
>> #{backingBean.someproperty[linkBean.arg1]} which causes an EL parsing
>> error.
>> I've tried some variations such as:
>> #{backingBean.someproperty[#{linkBean.arg1}]} and
>> #{backingBean[linkBean.arg1].someproperty}. These cause parsing errors
>> also.
>> I've verified that both backingBean.someproperty and linkBean.arg1 have
>> valid values.
>> These expressions in part implement a link as in <h:commandLink... on a
>> master list which grabs the current datatable row and renders the row
>> details on the next page - or at least it's supposed to!
>> What am i missing here?
>> Help appreciated.
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/JSF-EL-Problem-tp22874219p22874219.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/JSF-EL-Problem-tp22874219p22878863.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: JSF EL Problem

Posted by JavaRunner <ra...@bellsouth.net>.
Thanks for responding.  The signature of a typical accessor is public final
String getPatientFirstName() and the linkBean accessor is:    public String
getArg1().  The value returned by this get is a primitive int, a primary key
value defined as a primitive - ah, that's the problem.  I NEED TO CHANGE THE
SIGNATURE TO RETURN AN OBJECT IE; AN Integer.
I'm going to give that a try.
Thanks for your help and I'll let you know what the outcome is. 

Andrew Robinson-5 wrote:
> 
> #{backingBean.someproperty[linkBean.arg1]} is correct syntax, assuming
> that backingBean.someproperty is a map or list or other java object
> and not a primitive or something that the [] cannot be applied to.
> What is the signature of the getSomeProperty method on backingBean and
> the getArg1 on the linkBean?
> 
> Is the error on evaluating a get or set of the EL?
> 
> -Andrew
> 
> On Fri, Apr 3, 2009 at 1:31 PM, JavaRunner <ra...@bellsouth.net>
> wrote:
>>
>> Can anyone solve this?
>> I have an expression that looks like this:
>> #{backingBean.someproperty[linkBean.arg1]} which causes an EL parsing
>> error.
>> I've tried some variations such as:
>> #{backingBean.someproperty[#{linkBean.arg1}]} and
>> #{backingBean[linkBean.arg1].someproperty}. These cause parsing errors
>> also.
>> I've verified that both backingBean.someproperty and linkBean.arg1 have
>> valid values.
>> These expressions in part implement a link as in <h:commandLink... on a
>> master list which grabs the current datatable row and renders the row
>> details on the next page - or at least it's supposed to!
>> What am i missing here?
>> Help appreciated.
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/JSF-EL-Problem-tp22874219p22874219.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/JSF-EL-Problem-tp22874219p22878756.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: JSF EL Problem

Posted by Andrew Robinson <an...@gmail.com>.
#{backingBean.someproperty[linkBean.arg1]} is correct syntax, assuming
that backingBean.someproperty is a map or list or other java object
and not a primitive or something that the [] cannot be applied to.
What is the signature of the getSomeProperty method on backingBean and
the getArg1 on the linkBean?

Is the error on evaluating a get or set of the EL?

-Andrew

On Fri, Apr 3, 2009 at 1:31 PM, JavaRunner <ra...@bellsouth.net> wrote:
>
> Can anyone solve this?
> I have an expression that looks like this:
> #{backingBean.someproperty[linkBean.arg1]} which causes an EL parsing error.
> I've tried some variations such as:
> #{backingBean.someproperty[#{linkBean.arg1}]} and
> #{backingBean[linkBean.arg1].someproperty}. These cause parsing errors also.
> I've verified that both backingBean.someproperty and linkBean.arg1 have
> valid values.
> These expressions in part implement a link as in <h:commandLink... on a
> master list which grabs the current datatable row and renders the row
> details on the next page - or at least it's supposed to!
> What am i missing here?
> Help appreciated.
>
>
> --
> View this message in context: http://www.nabble.com/JSF-EL-Problem-tp22874219p22874219.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>