Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Problem: nothing works in jsp after downloading Excel.

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a "search.jsp" with a commandButton to generate excel. "Report.jsp" opens up in a new window when i click on this button by running below mentioned javascript. I can download Excel successfully by clicking on Download Excel link in report,jsp. Problem is, once i close this new window, I am unable to perform any other action in "search.jsp" even if i do not perform download. If i click on any other button or link "search.jsp", it replaces whole jsp with the Downlaod Excel link. and nothing happens after that . i need to close the seesion and start all over again from login page. Does anyone has solution. It will be big help. Thanks.


function aaaa()
mywindow'report.jsf', 'popupWindow', 'width=400,height=200,left=0,top=100,screenX=0,screenY=100');

Following is report.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">;
<%@ taglib uri=""; prefix="f" %>
<%@ taglib uri=""; prefix="h"%>
<%@ taglib uri=""; prefix="bjsf" %>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<h:commandLink actionListener="#{searchpage.export}" value="Download Excel" />
<a href="javascript:window.close();return false;">cancel</a>

Following is export function which runs when i click on above commandlink "Download Excel":

public void export(ActionEvent event) {
try {
FacesContext context = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) context
"attachment; filename=report.xls");
ServletOutputStream servletOutputStream = response
WritableWorkbook workbook = Workbook
WritableSheet sheet = workbook.createSheet("First Sheet", 0);
WritableFont lfont = new WritableFont(WritableFont.ARIAL, 10);
WritableCellFormat lformat = new WritableCellFormat(lfont);
lformat.setBorder(Border.ALL, BorderLineStyle.THICK);
WritableFont rfont = new WritableFont(WritableFont.ARIAL, 10);
WritableCellFormat rformat = new WritableCellFormat(rfont);
rformat.setBorder(Border.ALL, BorderLineStyle.THIN);
for (int i = 0; i < this.list.size(); i++) {
HashMap h = (HashMap) this.list.get(i);
if (i == 0) {
Set s = (Set) h.keySet();
Iterator itr = s.iterator();
int j = 1;
while (itr.hasNext()) {
Label label2 = new Label(j, 1,,
Collection c = h.values();
Iterator itr = c.iterator();
int j = 1;
while (itr.hasNext()) {
Label label2 = new Label(j, (i 2),,

} catch (Exception e) {
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic