Dear lord, of course it is not bound, the name of the parameter is
inccorect. It should be

    @Parameter(name = "*image*", required = false)
    private byte[] imageBytes;

And I was already debugging Tapestry sources...



2010/7/15 Christophe Cordenier <christophe.corden...@gmail.com>

> Hi
>
> AFAIK Primitive arrays are coerced to List.
>
> 2010/7/14 Borut Bolčina <borut.bolc...@gmail.com>
>
> > Hi,
> >
> > I am having problem binding a parameter of type byte[]. It is not bound
> for
> > some reason while imageTitle works as expected. The page template looks
> > like:
> >
> > <t:dynaimage t:image="imageBytes" t:title="imageTitle"/>
> >
> > DynaImage is my custom component which displays image from byte[], or so
> it
> > should :-)
> >
> > In my page class:
> >
> >    @Property
> >    private String imageTitle;
> >
> >    @Property
> >    private byte[] imageBytes;
> >
> >    void onActivate(Game game) {
> >        this.game = game;
> >        this.imageBytes = game.getImage();
> >        this.imageTitle = "Hello";
> >        logger.info("image size: " + this.imageBytes.length); //
> correctly
> > displays image size (cca 200kbytes)
> >    }
> >
> > And here is the component class:
> >
> > public class DynaImage {
> >
> >    @Inject
> >    private Logger logger;
> >
> >    @Inject
> >    private ComponentResources componentResources;
> >
> >    @Parameter(name = "imageBytes", required = false)
> >    private byte[] imageBytes;
> >
> >    @Parameter(name = "title", required = false)
> >    private String title;
> >
> >    @BeginRender
> >    protected boolean beginRender(MarkupWriter writer) throws SQLException
> {
> >        if (!componentResources.isBound("title")) {
> >            logger.warn("title not bound.");
> >        } else {
> >            logger.info("title: " + title);
> >        }
> >        if (!componentResources.isBound("imageBytes")) {
> >            logger.warn("imageBytes not bound.");
> >            return true;
> >        }
> >
> >        ImageIcon image = null;
> >
> >        image = new ImageIcon(imageBytes);
> >
> >        // Write an action link for this photo
> >        final Link link = componentResources.createEventLink("photo", new
> > Object[] { 999 });
> >        writer.element("img", "src", link, "title", title, "alt", "Loading
> "
> > + title, "height",
> >            image.getIconHeight(), "width", image.getIconWidth());
> >        componentResources.renderInformalParameters(writer);
> >
> >        writer.end();
> >        return true;
> >    }
> >
> >
> > Any help appreciated,
> > Borut
> >
>
>
>
> --
> Regards,
> Christophe Cordenier.
>
> Committer on Apache Tapestry 5
> Co-creator of wooki @wookicentral.com
>

Reply via email to