there are RequestUtils that can convert a wicket relative url to an
absolute one, if thats what you are asking.
there is no better way for you to get the src because direct access to
WEB-INF is not allowed, so you do have to stream it using a middleman
such as Image component instead of having the container stream it
directly.
-igor
On Tue, Apr 8, 2008 at 11:24 PM, unka_hahrry <[EMAIL PROTECTED]> wrote:
>
> I want that all image files in a given directory are shown on my site so that
> the admin can simply add/delete image files by editing the directory. So I
> do this with ListView:
>
> ImgListView imgListView = new ImgListView("listImageData", new
> LoadableDetachableModel()
> {
> protected Object load()
> {
> Folder folder = new
> Folder("D:/wicketex/Kunsthaus/context/WEB-INF/classes/ueberuns/images1");
> return Arrays.asList(folder.listFiles());
> }
> });
> add(imgListView);
>
> So my first problem is: how can I get the absolut path for my Folder?
>
> The images are added in the following way:
>
> public ImgListView(String name, final IModel files)
> {
> super(name, files);
> }
> protected void populateItem(ListItem listItem)
> {
> final File file = (File)listItem.getModelObject();
> Resource resource = new WebResource() {
>
> public IResourceStream getResourceStream() {
> IResourceStream stream = new FileResourceStream(file);
> return stream;
> }
> };
> Image image = new Image("imageFile", resource);
> image.add(new SimpleAttributeModifier("class", "bildlinks"));
> listItem.add(image);
> }
> }
>
> Is there a better way of adding the "src" to my image component?
>
> Thank you for your help!
> --
> View this message in context:
> http://www.nabble.com/ListView-with-images-and-getting-absolut-path-tp16580373p16580373.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]