You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by John Meredith <ps...@t-online.de> on 2003/06/21 12:13:45 UTC

"string:blah" not being parsed

Hi,

I'm still playing around with l10n property files and having problems
with the "string:" prefix. My understanding was that using this prefix,
I could directly access a localised string, however the result does not
seem to be parsed ie. the full "string:pagetitle" is displayed.

Eg:

<span jwcid="@Border" subtitle="string:pagetitle"> in my page.

In the properties file I have:

pagetitle=Home

The only thing I've been able to make work is:

<span jwcid="@Border" subtitle='ognl:messages.getMessage("title")'>

...but this seems a little unwieldy.

Does anyone have an idea why this is so or could recommend a better
approach.

Something else that would be neat, would be for the Border component to
automagically grab the property from it's containing page. Is there a
way I could do this with OGNL?

Thanks,

  John

(Sorry about the dumb questions :-)

-- 
John Meredith <ps...@t-online.de>


Re: "string:blah" not being parsed

Posted by Drew Davidson <dr...@ognl.org>.
John Meredith wrote:

>The only thing I've been able to make work is:
>
><span jwcid="@Border" subtitle='ognl:messages.getMessage("title")'>
>
>...but this seems a little unwieldy.
>
>Does anyone have an idea why this is so or could recommend a better
>approach.
>
>Something else that would be neat, would be for the Border component to
>automagically grab the property from it's containing page. Is there a
>way I could do this with OGNL?
>  
>
The new OGNL 2.6.0 (just released this past weekend) implements "Object 
Indexed Properties" automatically for objects that implement the 
following pattern:

    public <value-type> get<attribute-name>(<key-type> name);
    public void set<attribute-name>(<key-type> name, <value-type> value);

Note that the object must implement this pattern very strictly to be 
considered "object indexed"; it must have only one get and one set with 
the attribute name and the key-types and value-types must match exactly. 
 Not coincidentally all of the servlet stuff matches this pattern 
(HttpServletRequest, HttpSession, ServletContext).

So if the "messages" object above implemented:

    public String getMessage(String name);
    public void setMessage(String name, String value);

it would be considered object indexed and the expression you had:

    ognl:messages.getMessage("title")

could be rewritten as:
     
    ognl:messages.message["title"]

This may seem a trivial change but the expression above is both gettable 
AND settable; the previous one was get-only.  This is a very big 
difference as it becomes possible to now use object indexed attributes 
in synchronized bindings.

- Drew
  Creator of OGNL and WebOGNL
  King of Terseness

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




Re: "string:blah" not being parsed

Posted by John Meredith <ps...@t-online.de>.
Cheers. That worked.

  - John

On Sat, 2003-06-21 at 12:32, Julio C. Rivera wrote:
> Try it writting <span jwcid="@Border" subtitle="message:pagetitle">
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
-- 
John Meredith <ps...@t-online.de>


Re: "string:blah" not being parsed

Posted by "Julio C. Rivera" <ju...@ya.com>.
Try it writting <span jwcid="@Border" subtitle="message:pagetitle">