You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Joerg Flammiger (JIRA)" <in...@incubator.apache.org> on 2005/03/21 16:40:28 UTC

[jira] Created: (MYFACES-141) accessing properties of an extended "List"

accessing properties of an extended "List"
------------------------------------------

         Key: MYFACES-141
         URL: http://issues.apache.org/jira/browse/MYFACES-141
     Project: MyFaces
        Type: Bug
    Versions: 1.0.9 beta    
 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(ELParserHelper.java:418)
	at org.apache.myfaces.el.ELParserHelper.toIndex(ELParserHelper.java:440)
	at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:541)
	at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
	at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:441)
	at javax.faces.component.UIOutput.getValue(UIOutput.java:75)
	at org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:293)
	at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:159)
	at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:77)
	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:332)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-141) accessing properties of an extended "List"

Posted by "Joerg Flammiger (JIRA)" <in...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-141?page=comments#action_61358 ]
     
Joerg Flammiger commented on MYFACES-141:
-----------------------------------------

after reviewing the myfaces code, i created a workaround for this issue. i did some test and it seems to work fine (for a workaround). 

classname: org.apache.myfaces.el.ELParserHelper

    public static Integer toIndex(Object base, Object index)
        throws ELException, EvaluationException
    {
    	boolean isInt = true;
    	try {
    		Integer.parseInt(index.toString());
    	} catch(NumberFormatException e) {
    		isInt = false;
    	}
    	if ( ((base instanceof List) || (base.getClass().isArray())) && (isInt) )
        {
        	return coerceToIntegerWrapper(base, index);
        }
        .
        .
        .
        
   
  

> accessing properties of an extended "List"
> ------------------------------------------
>
>          Key: MYFACES-141
>          URL: http://issues.apache.org/jira/browse/MYFACES-141
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.0.9 beta
>  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(ELParserHelper.java:418)
> 	at org.apache.myfaces.el.ELParserHelper.toIndex(ELParserHelper.java:440)
> 	at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:541)
> 	at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
> 	at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:441)
> 	at javax.faces.component.UIOutput.getValue(UIOutput.java:75)
> 	at org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:293)
> 	at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:159)
> 	at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:77)
> 	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:332)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-141) accessing properties of an extended "List"

Posted by "Heath Borders-Wing (JIRA)" <in...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-141?page=comments#action_61333 ]
     
Heath Borders-Wing commented on MYFACES-141:
--------------------------------------------

This is probably a spec issue and not an implementation issue.

> accessing properties of an extended "List"
> ------------------------------------------
>
>          Key: MYFACES-141
>          URL: http://issues.apache.org/jira/browse/MYFACES-141
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.0.9 beta
>  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(ELParserHelper.java:418)
> 	at org.apache.myfaces.el.ELParserHelper.toIndex(ELParserHelper.java:440)
> 	at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:541)
> 	at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
> 	at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:441)
> 	at javax.faces.component.UIOutput.getValue(UIOutput.java:75)
> 	at org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:293)
> 	at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:159)
> 	at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:77)
> 	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:332)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira