• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Excel spread sheet (in JSP) display issues

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
subject: Excel spread sheet (in JSP) specific name display issues

Environment: Java, J2EE, MyEclipse, Oracle WebShpere ,Struts framwork

I have few reports and clicking the report executes an action and displays the corresponding report (Action forward).

Before displaying the report it pops up a window (with save/open/cancel buttons). Now the widnow has same name for all the reports (load-reports.xls).
I need to display a specific report name.
I searched the work sapce and ould not find any clue.
Any help will be appreciated, TIA
Mike
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look up the Content-Disposition response header.
There is sample code that sets this in our JspAndExcel FAQ entry.
There is a link to the JspFaq at the top of this forum.
 
Mike Broad
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you a lot Ben.
I appreciate your help.
This code in my jsp works fine, has there been only one custom name to display:

<%@ page contentType="application/vnd.ms-excel" autoFlush="true" %>
<% response.setHeader("Content-Disposition", "attachment; filename=\"EmployeeReport.xls\""); %>

But still I am not able to figure out completely.
I know the logic , but need some help.

I have nearly 10 reports and I need to use <c:if ...> tag in my Jsp and display the right report name ( on the Excel file)
Can you pl help me how I can do it in my report.jsp .


// In the ReportAction.execute(.....) method
//I have set the report name as an attribute
....
Report report = new Report ();
String r_name = report. getName(); // EmployeeReport, ?ManagerReport etc

System.out.println ("\n\n rep...name: " + s_r_name + "\n") ;
//outputs the expected name to console
req.setAttribute("reportName", r_name );

I need to retrieve it in jsp and add logic to display specific report name such as EmployeeReport, MangerReport etc

Currently my jsp file has these 6 lines of code code:

<%@ taglib uri="/WEB-INF/rep.tld" prefix="rep" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ page import="com.xyz.report.Report" %>

<%@ page contentType="application/vnd.ms-excel" autoFlush="true" %>
<% response.setHeader("Content-Disposition", "attachment; filename=\"EmployeeReport.xls\""); %>
<rep:displayReport/>

Thanks,
Mike
 
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic