Target page has a property of type List with beans that keeps images in byte
arrays. I need to render those images in the iterator on the same page. It
seems may be like in tapestry "Workbench" tutorial with a dynamic chart but
with more than one image. But during iterations service always renders the
same image (generally the last in the list).
// The component template looks like:
<FORM jwcid="@Form" listener="ognl:listeners.onClick" >
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR jwcid="@Foreach" source="ognl:banners"
value="ognl:banner" element="TR">
<TD>
<IMG jwcid="@ImageSubmit"
image="ognl:bannerImageAsset" selected="ognl:targetUrl"
tag="ognl:banner.url" alt="ognl:banner.title" title="ognl:banner.title"/>
</TD>
</TR>
</TABLE>
</FORM>
// BannerAsset
public BannerAsset(IRequestCycle cycle, IComponent provider) {
super(null, null);
IEngine engine = cycle.getEngine();
bannerService = engine.getService(BannerService.SERVICE_NAME);
bannerProvider = provider;
}
public String buildURL(IRequestCycle cycle) {
ILink link = bannerService.getLink(cycle, bannerProvider, null);
return link.getURL();
}
}
// BannerService::service()
public void service(IEngineServiceView engine, IRequestCycle cycle,
ResponseOutputStream output) throws
ServletException, IOException {
String context[] =
getServiceContext(cycle.getRequestContext());
String pageName = context[0];
String idPath = (context.length == 1) ? null : context[1];
IPage page = cycle.getPage(pageName);
IComponent component = (idPath == null) ? page : page
.getNestedComponent(idPath);
try {
Banners provider = (Banners) component;
Banner banner = provider.getBanner();
output.setContentType(banner.getData().getContentType());
output.write(banner.getData().getData());
} catch (ClassCastException ex) {
engine.reportException("Component " +
component.getExtendedId()
+ " is not of type Banners.", ex);
return;
}
return;
}
-----Original Message-----
From: Scott F. Walter [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 19, 2005 4:20 PM
To: Tapestry users
Subject: Re: Multiple dynamic images on the same page
Oleksandr Yuzikov wrote:
>Hi.
>
>
>
>I stuck with a problem to represent some images (say 5) on single page.
>Images stored in the database. I did like in the tapestry "workbench"
>example with a chart but it doesn't work with more than one image. So does
>anyone have some experience to solve such of problem?
>
>
>
>Thanks.
>
>
>
>
Why do you think the Chart service cannot work with multiple images? I
have a modified version of the chart service and I have 2 instances of a
chart (dynamically generated image) on the same page. What kind of
problems are u having?
scott.
--
Scott F. Walter Scott F. Walter
Principal Consultant
Vivare, Inc.
E: [EMAIL PROTECTED]
E: [EMAIL PROTECTED]
Visit scottwalter.com <http://scottwalter.com> --Point. Click. Explore!
---------------------------------------------------------------------
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]