class MyImage extends WebComponent {
public void onComponentTag(ComponentTag tag) {
tag.put("src", url);
...
}
}
On Mon, Dec 5, 2011 at 7:16 PM, Daniel Watrous
<[email protected]> wrote:
> I'm still trying to figure this out. I would like to be able to do something
> like the following:
>
> HTML:
> <img wicket:id="testimage">
>
> JAVA:
> public class ImageTestPage extends WebPage{
> public ImageTestPage() {
> Image myImg = new Image("testimage");
> myImg.setUrlForImageSrc("http://path/to/image.gif");
> myImg.setWidth(200);
> myImg.setHeight(100);
> add(myImg);
> }
> }
>
> Obviously the Image class doesn't work that way... Can someone tell me how I
> would accomplish this so that I can define the image, height and width
> independent from the markup?
>
> Daniel
>
> -----Original Message-----
> From: Daniel Watrous [mailto:[email protected]]
> Sent: Friday, December 02, 2011 5:20 PM
> To: [email protected]
> Subject: best way to accommodate dynamic properties
>
> I'm interested in having pulling the width and height for an img from a
> database, but I'm not sure what the best way is to create a component and
> corresponding HTML mapping.
>
> Please send an example or link to previous response if possible. I've
> searched the users list archives but didn't find what I was looking for.
>
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]