This works for me, in case anyone's interested in a simple solution.

I have a ListView which outputs Books (their Title, Author, etc., and also a
Book Image which is a JPG stored in a DB), all per row, based on a POJO
called "Book" which stores all this info. "Book" also has a byte[] for the
Image field.

        add(new ListView("books", books) {

            @Override
            protected void populateItem(ListItem li) {
                Book b = (Book) li.getModelObject();
                li.add(new Label("bookId", b.getBookId().toString()));
                li.add(new Label("bookTitle", b.getBookTitle()));
                li.add(new Label("bookAuthors", b.getBookAuthors()));
                li.add(new Label("bookPrice",
Integer.toString(b.getBookPrice())));
                // add book image
                ByteArrayResource resourceBookImg = new
ByteArrayResource("image/jpeg", b.getBookImg());
                TechBooksApplication.get().getSharedResources().add("img" +
li.getIndex(), resourceBookImg);
                Image imgBook = new Image("bookImg", resourceBookImg);
                li.add(imgBook);

            }
     });


Maybe this isn't quite what Miroslav wants, but for me I don't need to
re-format URLs, so this is working fine for me.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/url-for-images-from-database-tp3657615p3700046.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to