Re: Referencing images in javascript - wicket 1.3.1

2008-03-31 Thread Andrew Moore

Thanks, that's perfect.


igor.vaynberg wrote:
> 
> urlfor(new resourcereference(Panels.class, "folder.gif"));
> 
> -igor
> 
> 
> On Fri, Mar 28, 2008 at 1:11 AM, Andrew Moore <[EMAIL PROTECTED]>
> wrote:
>>
>>  I'm using wicket 1.3.1 and have a javascript file which needs to
>> reference
>>  some images.
>>
>>  I'm using the following code in a panel to include the javascript with
>>  images:
>>
>>  CharSequence folder = getRequest().getRelativePathPrefixToContextRoot()
>> +
>>  "folder.gif";
>>  PackagedTextTemplate js = new PackagedTextTemplate(PageTreePanel.class,
>>  "folder-tree-static.js");
>>  Map map = new HashMap();
>>  map.put("folder", folder);
>>  add(TextTemplateHeaderContributor.forJavaScript(js, new
>>  Model((Serializable)map)));
>>
>>  Now, I can see that my ${folder} reference that I had in the javascript
>> is
>>  getting replaced with the image file name, but the
>>  getRelativePathPrefixToContextRoot() returns "../" so the javascript
>> image
>>  reference comes out as "../folder.gif"
>>
>>  I've tried to place the images all over the place, but cannot get it to
>> find
>>  them.
>>
>>  If I use firebug to manually edit the url to
>>  "resources/com.example.web.page.Panels/folder.gif" then the image shows.
>> I
>>  just can't work out the correct way (or location) to place the image.
>>
>>  Any help would be great.
>>  Thanks
>>  Andrew
>>
>>
>>
>>  --
>>  View this message in context:
>> http://www.nabble.com/Referencing-images-in-javascript---wicket-1.3.1-tp16347523p16347523.html
>>  Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>>  -
>>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>>  For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Referencing-images-in-javascript---wicket-1.3.1-tp16347523p16392864.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Referencing images in javascript - wicket 1.3.1

2008-03-28 Thread Igor Vaynberg
urlfor(new resourcereference(Panels.class, "folder.gif"));

-igor


On Fri, Mar 28, 2008 at 1:11 AM, Andrew Moore <[EMAIL PROTECTED]> wrote:
>
>  I'm using wicket 1.3.1 and have a javascript file which needs to reference
>  some images.
>
>  I'm using the following code in a panel to include the javascript with
>  images:
>
>  CharSequence folder = getRequest().getRelativePathPrefixToContextRoot() +
>  "folder.gif";
>  PackagedTextTemplate js = new PackagedTextTemplate(PageTreePanel.class,
>  "folder-tree-static.js");
>  Map map = new HashMap();
>  map.put("folder", folder);
>  add(TextTemplateHeaderContributor.forJavaScript(js, new
>  Model((Serializable)map)));
>
>  Now, I can see that my ${folder} reference that I had in the javascript is
>  getting replaced with the image file name, but the
>  getRelativePathPrefixToContextRoot() returns "../" so the javascript image
>  reference comes out as "../folder.gif"
>
>  I've tried to place the images all over the place, but cannot get it to find
>  them.
>
>  If I use firebug to manually edit the url to
>  "resources/com.example.web.page.Panels/folder.gif" then the image shows. I
>  just can't work out the correct way (or location) to place the image.
>
>  Any help would be great.
>  Thanks
>  Andrew
>
>
>
>  --
>  View this message in context: 
> http://www.nabble.com/Referencing-images-in-javascript---wicket-1.3.1-tp16347523p16347523.html
>  Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
>  -
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]