You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Johannes Schneider <ma...@cedarsoft.com> on 2009/07/02 21:49:54 UTC

Image with parameters

Hi,

I have registered a shared resource with
IndexedSharedResourceCodingStrategy.
Now I want to add an image to one of my pages. But of course I need to
add a parameter to that image. How can this be done? I really can't find
any fitting constructor...

What I have so far is:



    ResourceReference imageResource = new ResourceReference(
"MyWellKnownKey" );

    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put( "0", "myParameterIWantToAdd );

    CharSequence url = RequestCycle.get().urlFor( imageResource, new
ValueMap( map ) ); //that URL looks good! But what to do with?

    add( new Image( "image", String.valueOf( url ) ) ); //does not work



Where is

new ResourceReference ("MyWellKnownKey" , new ValueMap() );



Any hints?


Thanks,

Johannes

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Image with parameters

Posted by Johannes Schneider <ma...@cedarsoft.com>.
Aaaaaah!

Okay, found it....
It is exactly where it should be:

add( new Image( "image", imageResource, new ValueMap( map ) ) )


Thanks...

Joe

Johannes Schneider wrote:
> Hi,
> 
> I have registered a shared resource with
> IndexedSharedResourceCodingStrategy.
> Now I want to add an image to one of my pages. But of course I need to
> add a parameter to that image. How can this be done? I really can't find
> any fitting constructor...
> 
> What I have so far is:
> 
> 
> 
>     ResourceReference imageResource = new ResourceReference(
> "MyWellKnownKey" );
> 
>     HashMap<String, Object> map = new HashMap<String, Object>();
>     map.put( "0", "myParameterIWantToAdd );
> 
>     CharSequence url = RequestCycle.get().urlFor( imageResource, new
> ValueMap( map ) ); //that URL looks good! But what to do with?
> 
>     add( new Image( "image", String.valueOf( url ) ) ); //does not work
> 
> 
> 
> Where is
> 
> new ResourceReference ("MyWellKnownKey" , new ValueMap() );
> 
> 
> 
> Any hints?
> 
> 
> Thanks,
> 
> Johannes
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org