it should work, what does the finished output look like. btw for tag w/out body you should use WebComponent not WebMarkupContainer.

-Igor


On 3/28/06, Frank Silbermann <[EMAIL PROTECTED]> wrote:

But my "src" attribute to be modified _is_ in my HTML, as you can see (value shown is "REPLACE_THIS.png").  The problem is that the existing "src" attribute's value was not replaced.  What do I need to do differently?

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Igor Vaynberg
Sent: Tuesday, March 28, 2006 11:56 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Location of image files

 

attribute modifiers do not add attributes into your markup by default - they only modify the ones thats there, if you want to add an attribute you need to add another constructor argument:

new AttributeModifier( "src", /true/, new Model(pictureFile) )

also you cannot link to resources under WEB-INF so your static folder will have to be higher then that.

-Igor

On 3/28/06, Frank Silbermann < [EMAIL PROTECTED] > wrote:

I wanted a panel constructed with an image filename which would popup the image in another window.  I wanted my code in one place, my static image files stored in the WEB-INF folder of my web module, and couldn't figure out how to make Image component find them.  Igor replied:

 

 "If they live outside a jar in a static location then why do you even need an Image component?  Add a webmarkup container with an attribute modifier that rewrites the src attri to point at an image, and attach that to <img markup>."

 

What Igor suggested is exactly what I want to do, but I'm having trouble changing the "src" attribute on my image display page.  My HTML for the pop-up panel is:

<html xmlns=" http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/" xml:lang="en" lang="en">

<head></head>

<body>

          <img wicket:id = "picture" alt="Picture" src="">

</body>

</html>

 

My code is:

 

public class PicturePage extends WebPage {

 

  public PicturePage( PageParameters pageParameters ) {

    String pictureFile = pageParameters.getString("pictureFile");

 

    WebMarkupContainer wmc = new WebMarkupContainer("picture");

    wmc.add( new AttributeModifier( " src", new Model(pictureFile) )  );

    add( wmc );

  }

}

 

But it is not changing my "src" attribute.  What am I doing wrong?

 

 


Reply via email to