Or use

public class SimpleImage extends WebComponent {

        public SimpleImage(String id, String imgSrc) {
                super(id, new Model(imgSrc));
        }

        public SimpleImage(String id, IModel imgSrcModel) {
                super(id, imgSrcModel);
        }

        protected void onComponentTag(ComponentTag tag) {
                tag.getAttributes().put("src", getModelObjectAsString());
        }
}

Eelco


On 11/14/05, Johan Compagner <[EMAIL PROTECTED]> wrote:
> ok you do write in the webapplication directory..
>  You do have always complete control over it where youre webapp will be
> installed on? And what kind of application server is used?
>  Because you do know that writeable access isn't guarenteed? Or that it is
> even a directory at all?
>  Application servers could just use the war directly without extracting it.
>
>  If you can do that then i would just have the <img tag> directly in the
> html
>  With a wicket id and then you use a label componet which only has a
> attribute modifier to set the src attribute.
>  That looks to me as the cleanest method.
>
>
>
>
> On 11/14/05, James Yong <[EMAIL PROTECTED]> wrote:
> > Johan Compagner <jcompagner <at> gmail.com> writes:
> >
> > >
> > >
> > > Of course you save youre files to a server you have to know the folder
> where
> > you have write access.
> > > Then you can load them from that location just as fine as reading them
> from a
> > database.
> > >
> > Hi,
> >
> > I used a label to generate the img tag. It works for me. But I am not sure
> if
> > there is a more correct way to do. Any comments?
> >
> > listItem.add(new Label("file_img", "<img src='" + childfolder + "/" +
> > file.getName() +  "'
> />").setEscapeModelStrings(false).setRenderBodyOnly(true));
> >
> > Regards,
> > james
> >
> >
> >
> >
> > -------------------------------------------------------
> > SF.Net email is sponsored by:
> > Tame your development challenges with Apache's Geronimo App Server.
> Download
> > it for free - -and be entered to win a 42" plasma tv or your very own
> > Sony(tm)PSP.  Click here to play:
> http://sourceforge.net/geronimo.php
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to