You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Byrne, Steven" <SB...@dorado.com> on 2003/10/29 02:24:51 UTC

Simple question [OGNL syntax]

The OGNL documentation says that I can use a notation like
 
    property["SomeString"]
 
to refer to properties which are indexed by some type (in this case,
String) other than int, and OGNL will recognize the pattern
 

	public PropertyType getPropertyName(IndexType index)
	public void setPropertyName(IndexType index, PropertyType value)
	 

and allow the property access syntax as described above.   
 
I can't get this to work in Tapestry 3.0-Beta3, so I'm wondering if 

*	There is some trick to it
*	Tapestry 3.0-Beta3 does not yet support that version of OGNL
*	I'm doing something braindead

Please don't tell me it's #3 :)
 
Steve

Re[2]: Simple question [OGNL syntax]

Posted by Max Grigoriev <da...@mail.ru>.
Hello Drew,

Wednesday, October 29, 2003, 10:09:53 PM, you wrote:

DD> Max Grigoriev wrote:

>>Hello Steven,
>>
>>You have to have 2 methods
>>first: setName(Language lang, String value)
>>AND setName(int lang, String value)
>>then you can use name[SOME_LANG];
>>  
>>
DD> This is not true, and will in fact nullify the usage of OGNL Object
DD> Indexed properties for the "name" property.

I looked at ognl source code. And find that it uses BeanInfo to access
to the properties. So the property is index in default realization
when it has getXXX(int index), setXXX(int index, Object value) or you
have to write BeanInfo fot your classes. I think the easy way just has
methods with "int index" than create BeanInfo.


-- 
Best regards,
 Max                            mailto:darkit@mail.ru


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Simple question [OGNL syntax]

Posted by Drew Davidson <dr...@ognl.org>.
Max Grigoriev wrote:

>Hello Steven,
>
>You have to have 2 methods
>first: setName(Language lang, String value)
>AND setName(int lang, String value)
>then you can use name[SOME_LANG];
>  
>
This is not true, and will in fact nullify the usage of OGNL Object 
Indexed properties for the "name" property.

To be considered an object indexed property the methods must be 
implemented exactly like documented in the OGNL documentation:

public String getName(Language lang)
public void setName(Language lang, String value)

If you have JavaBeans indexed properties they will only deal with int 
indexes.  Implementing these will interfere with OGNL's discovery of 
object indexed properties.

As to the original question, Steven, you have implemented the correct 
pattern for your objects, it appears (since you quote the OGNL doc), 
however the syntax you stated :

    property["SomeString"]

would be incorrect for the "someString" property because the first 
letter is capitalized.  It must be in JavaBeans format, with initial 
lower case.

I don't know which version of OGNL is provided with Tapestry 3.0 b1 but 
I suspect it's pretty current.  They keep right on the bleeding edge 
most of the time :-)

- Drew

-- 
+---------------------------------+
< Drew Davidson | OGNL Technology >
<     Professional Open Source    >
+---------------------------------+
|  Email: drew@ognl.org          /
|    Web: http://www.ognl.org   /
|    Vox: (520) 531-1966       <
|    Fax: (520) 531-1965        \
| Mobile: (520) 405-2967         \
+---------------------------------+



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Simple question [OGNL syntax]

Posted by Max Grigoriev <da...@mail.ru>.
Hello Steven,

You have to have 2 methods
first: setName(Language lang, String value)
AND setName(int lang, String value)
then you can use name[SOME_LANG];



Wednesday, October 29, 2003, 4:24:51 AM, you wrote:

BS> MessageThe OGNL 
BS> documentation says that I can use a notation like

BS>  

BS>     
BS> property["SomeString"]

BS>  

BS> to refer to 
BS> properties which are indexed by some type (in this case, String) other than int,
BS> and OGNL will recognize the pattern

BS>  

BS>  public PropertyType getPropertyName(IndexType index)

BS>  public void 
BS>   setPropertyName(IndexType index, PropertyType value)

BS>   



BS> and allow the property access syntax as described 
BS> above.   

BS>  

BS> I can't get 
BS> this to work in Tapestry 3.0-Beta3, so I'm wondering if

BS>  There is some 
BS>   trick to it Tapestry 
BS>   3.0-Beta3 does not yet support that version of OGNL I'm doing 
BS>   something braindead

BS> Please don't 
BS> tell me it's #3 :)

BS>  

BS> Steve



 



-- 
Best regards,
 Max                            mailto:darkit@mail.ru


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Simple question [OGNL syntax]

Posted by Paul Ferraro <pm...@columbia.edu>.
I know that the ognl version distributed with Tapestry is a couple of 
versions behind.  You should be able to upgrade your version to v2.6.3 
without issue @ http://www.ognl.org/download.html

I expect that the next release of Tapestry will include this.

Paul

Byrne, Steven wrote:

> The OGNL documentation says that I can use a notation like
>  
>     property["SomeString"]
>  
> to refer to properties which are indexed by some type (in this case, 
> String) other than int, and OGNL will recognize the pattern
>  
>
>     public /PropertyType/ get/PropertyName/(/IndexType /index)
>     public void set/PropertyName/(/IndexType /index, /PropertyType /value)
>      
>
> and allow the property access syntax as described above.  
>  
> I can't get this to work in Tapestry 3.0-Beta3, so I'm wondering if
>
>     * There is some trick to it
>     * Tapestry 3.0-Beta3 does not yet support that version of OGNL
>     * I'm doing something braindead
>
> Please don't tell me it's #3 :)
>  
> Steve
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>