You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by COLLIN Gérard <ge...@netonomy.com> on 2004/03/23 09:56:20 UTC

ognl: is it a bug ?

Hi,

 I'm fearly new to Tapestry development so maybe it's a stupid question.

 Using Tapestry rc1, i've got a problem with OGNL inside a component.
 This component display an Image who's url is stored in a bean.
 If I write this for binding:

<component-specification allow-informal-parameters="no" allow-body="no">
   <parameter direction="in" type="com.netonomy.proto.Handset" 
name="toDisplay"/>

 <component id="phoneImage" type="Image">
    <binding name="image" expression="toDisplay.pictureUrl"/>
  </component>
</component-specification>

OGNL is fine but I've got an error because toDisplay.pictureUrl is a String 
and the Image component expect an IAsset. OK No problem, I add a method in 
the Page object to do the convert.
So I now have an expression like that:

<component id="phoneImage" type="Image">
    <binding name="image" 
expression="page.createRelativeAsset(toDisplay.pictureUrl)"/>
  </component>

And now I've got an OGNL error "toDisplay property not found !" Ouups ? What's 
wrong here ?

I finally managed to make it work with a temporary variable, like that :
<component id="phoneImage" type="Image">
    <binding name="image" expression="#url=toDisplay.pictureUrl, 
page.createRelativeAsset(#url)"/>
  </component>

But this solution doesn't seem to be very elegant....
Any other ideas ? What's wrong with my OGNL ?

  Gérard

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


RE: ognl: is it a bug ?

Posted by David Solis <ds...@legosoft.com.mx>.
The expression 'page.createRelativeAsset(toDisplay.pictureUrl)' should
be OK.
It sounds like a bug in org.apache.tapestry.binding.ExpressionBinding.
Could you please add a bug to Bugzilla about this one?

Regards

David
> -----Original Message-----
> From: COLLIN Gérard [mailto:gerard.collin@netonomy.com]
> Sent: Tuesday, March 23, 2004 2:56 AM
> To: Tapestry users
> Subject: ognl: is it a bug ?
> 
> Hi,
> 
>  I'm fearly new to Tapestry development so maybe it's a stupid
question.
> 
>  Using Tapestry rc1, i've got a problem with OGNL inside a component.
>  This component display an Image who's url is stored in a bean.
>  If I write this for binding:
> 
> <component-specification allow-informal-parameters="no"
allow-body="no">
>    <parameter direction="in" type="com.netonomy.proto.Handset"
> name="toDisplay"/>
> 
>  <component id="phoneImage" type="Image">
>     <binding name="image" expression="toDisplay.pictureUrl"/>
>   </component>
> </component-specification>
> 
> OGNL is fine but I've got an error because toDisplay.pictureUrl is a
> String
> and the Image component expect an IAsset. OK No problem, I add a
method in
> the Page object to do the convert.
> So I now have an expression like that:
> 
> <component id="phoneImage" type="Image">
>     <binding name="image"
> expression="page.createRelativeAsset(toDisplay.pictureUrl)"/>
>   </component>
> 
> And now I've got an OGNL error "toDisplay property not found !" Ouups
?
> What's
> wrong here ?
> 
> I finally managed to make it work with a temporary variable, like that
:
> <component id="phoneImage" type="Image">
>     <binding name="image" expression="#url=toDisplay.pictureUrl,
> page.createRelativeAsset(#url)"/>
>   </component>
> 
> But this solution doesn't seem to be very elegant....
> Any other ideas ? What's wrong with my OGNL ?
> 
>   Gérard
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org



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