On 7/4/07, Gohan <[EMAIL PROTECTED]> wrote:


I'm using wicket 1.2.6 and I'd like to display simple gif images.

I have the following code in my constructor for WelcomePage:
add(new Image("toplogo", new ResourceReference(WelcomePage.class,
                                "toplogo.gif")));

The html looks like:
..
<tr><td> </img></td></tr>


</img>? shouldnt that be <img/> and then <img wicket:id="img"/>?

..

The toplogo.gif is located in the same directory as the WelcomePage.
When I load the application the page the images is distorted, it's like
somebody has "smeared" the image.


not sure, never seen that happen. try setting width/height on the img tag -
longshot, but hay :)


The second question is how I should go about to load an image that is
located in a resource folder (i.e. src/main/resources). If I just go with
add(new Image("toplogo", new ResourceReference(toplogo.gif"))), the images
is resolved to
http://localhost:8080/app/resources/wicket.Application/toplogo.gif, but I
want the image to be loaded from the resource root directory.


files in src/main/resources get copied directly into classes dir - that
means for all intents and purposes they are in the default package. you need
to have a class in the default package you can use as a scope.

-igor
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to