myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "me (JIRA)" <>
Subject [jira] Commented: (MYFACES-141) accessing properties of an extended "List"
Date Thu, 22 Mar 2007 12:18:32 GMT


me commented on MYFACES-141:

I should think this issue is a good/useful and needed functionality and strongly suggest to
reopen it
(as long as it's not an spec issue as Heath Borders-Wing suspects).

I found a number of pages on the web where developers want to extend a List and access its
extended properties on jsf pages.

I personally would like to use it at least to make a List's size()  method available on a
jsf/jsp page
e.g. for displaying/hiding list paginators for lists:

the extended List class:
public class BeanVector<E> extends Vector<E> {
    public Integer getSize() {
        return new Integer(this.size());

used like:
public class SampeBean {
    public BeanVector getMyList() {...}

and accordingly in the jsf page:

<t:dataTable	id="someId"
    value="#{sampleBean.myList}" var="myItem" 
<t:dataScroller id="otherId"  for="someId"
    rendered="#{sampleBean.myList.size > 15}"
    fastStep="15"  paginator="true"

I mean this makes sense,
or am I getting something very wrong and there are other, better ways to implement something
like this example?

(of course i could add an additional getter  sampleBean like sampleBean.getMyListSize() :
but i think this would not be really nice OOP...)

so any proposals or solutions?

> accessing properties of an extended "List"
> ------------------------------------------
>                 Key: MYFACES-141
>                 URL:
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.0.9m9
>         Environment: JBoss 4.0.1sp1, my-faces-1.0.9
>            Reporter: Joerg Flammiger
> If a class "MyList" extends the class "ArrayList" and the class "MyList" has various
getter and setter methods, then it is not possible to access such properties in the jsp/jsf
page. an example expression is: #{sampleBean.testList.testValue} . the expression resolver
think "testValue" is an index; therefore, it tries to convert "testValue" to an integer, which
will fail. In my opinion, "testValue" should refer to the implemented methods "getTestValue"
and "setTestValue".
> You will get the following exception:
> 2005-03-21 15:58:12,312 ERROR [org.apache.myfaces.el.ValueBindingImpl] Cannot get value
for expression '#{sampleBean.testList.testValue}'
> javax.faces.el.ReferenceSyntaxException: Cannot convert index to int for base mypackage.MyList
and index maxItems
> 	at org.apache.myfaces.el.ELParserHelper.coerceToIntegerWrapper(
> 	at org.apache.myfaces.el.ELParserHelper.toIndex(
> 	at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(
> 	at org.apache.commons.el.ComplexValue.evaluate(
> 	at org.apache.myfaces.el.ValueBindingImpl.getValue(
> 	at javax.faces.component.UIOutput.getValue(
> 	at org.apache.myfaces.renderkit.RendererUtils.getStringValue(
> 	at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(
> 	at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(
> 	at javax.faces.component.UIComponentBase.encodeEnd(

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message