Hi,
You can use PopupLinkRenderer with an ExternalLink to popup a window
that will display the excel sheet. I do something similar for displaying
images (jpeg, gif). Here are excerpts of TP4 code that you will need:
1. In the html file that has the export link
<a jwcid="export_excel_sheet" href="#">Export Excel</a>
2. In the .page with the Export button
<bean name="imageLinkRenderer"
class="com.arabiandreams.tapestry.component.MyPopupLinkRenderer">
<set name="windowName" value="literal:"/>
<set name="features"
value="literal:location=no,status=yes,menubar=no,width=800,height=600,scrollbars=yes,resizable=yes"/>
</bean>
<!-- further down in the .page file. the export link -->
<component id="view_large_photo" type="ExternalLink">
<binding name="page" value="literal:DisplayExcelPage"/>
<binding name="parameters" value="ognl:excelSheetFileName"/>
<binding name="renderer" value="ognl:beans.imageLinkRenderer"/>
</component>
3. In the .java file
public String getExcelSheetFilename()
{
// return the name of the filename, perhaps with complete path
return "excel.wrk";
}
4. The MyPopupLinkRenderer.java
// override the contructURL method of PopupLinkRenderer so that the
// rewind cycle can be checked. See
// http://issues.apache.org/jira/browse/TAPESTRY-774
//
package com.arabiandreams.tapestry.component;
import org.apache.tapestry.contrib.link.PopupLinkRenderer;
import org.apache.tapestry.components.ILinkComponent;
import org.apache.tapestry.IRequestCycle;
public class MyPopupLinkRenderer extends PopupLinkRenderer
{
public String constructURL(ILinkComponent link, IRequestCycle cycle)
{
if (cycle.isRewinding()) {
return null;
}
return super.constructURL(link, cycle);
}
}
5. The DisplayExcelPage.java implements the IExternalPage Interface. The
activateExternalPage method retrieves the excel sheet file name and
displays it.
public abstract class DisplayExcelPage implements IExternalPage
{
...
...
public void activateExternalPage(Object[] parameters, IRequestCycle
cycle)
{
// get the filename shipped via the ExternalLink Interface
String excelFilename = (String) parameters[0];
//
// The DisplayExcelPage will show up in its own window. the window
// can have "close this window" link or whatever.
}
Hope this help.
Regards,
Sohail Aslam
sohail dot aslam at google mail dot calm
Vincent wrote:
Chris , I think maybe I am not explain clearly.
My problem is that in one page called a.html for example , there has a
button called "export" that I can export the page information to excel
, I did get the excel information but was in the same page(a.html) ,
I wish the result file can popup a new page instead of directly
overwrite the currently page.
Is it possible to do that?
Also in IRequestCycle is it possible to popup a page? As far as I know
IRequestCycle.active() will only direct to other page.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]