This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem: nothing works in jsp after downloading Excel.  RSS feed

Priyanka mittal
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) {
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!