留言板
Page freezes after download - unable to click button
Curtis Hayes,修改在15 年前。
Page freezes after download - unable to click button
New Member 发布: 1 加入日期: 08-4-17 最近的帖子
Problem Description: after performing a submit to an action which sets the HttpServletResponse to download a file, the file downloads, however the page on which the action was initiated does not allow any of its buttons to gain focus, thus I am unable to click them. If I refresh the page via the browser button, the buttons are able to gain focus, however if I code the refresh using javascript then the page refreshes without performing the download.
Here is the code from my action:
byte[] byteArray = call to method which returns a byteArray
response.reset();
response.setContentType("application/x-msdownload");
response.addHeader("Content-Disposition","attachment; filename=\"" + new String(fileName.getBytes())+ "\"");
ServletOutputStream output = null;
try{
output = response.getOutputStream();
output.write(byteArray);
output.flush();
}
catch(Exception e){
_logger.error(e, e);
}
finally{
output.close();
}
Here is the JSP code:
<input class="portlet-form-button" type="button" value="Export" onClick='updateParamStrings(); submitForm(document.communityEditForm, "<portlet:actionURL windowState="<%=LiferayWindowState.EXCLUSIVE.toString()%>"><portlet:param name="struts_action" value="/community_register/communityedit"/><portlet:param name="method" value="export"/></portlet:actionURL>");'>
I have also tried adding "return false" at the end of the onClick event chain. No result.
Any advice, help, criticisms would be greatly appreciated
Thank you
Here is the code from my action:
byte[] byteArray = call to method which returns a byteArray
response.reset();
response.setContentType("application/x-msdownload");
response.addHeader("Content-Disposition","attachment; filename=\"" + new String(fileName.getBytes())+ "\"");
ServletOutputStream output = null;
try{
output = response.getOutputStream();
output.write(byteArray);
output.flush();
}
catch(Exception e){
_logger.error(e, e);
}
finally{
output.close();
}
Here is the JSP code:
<input class="portlet-form-button" type="button" value="Export" onClick='updateParamStrings(); submitForm(document.communityEditForm, "<portlet:actionURL windowState="<%=LiferayWindowState.EXCLUSIVE.toString()%>"><portlet:param name="struts_action" value="/community_register/communityedit"/><portlet:param name="method" value="export"/></portlet:actionURL>");'>
I have also tried adding "return false" at the end of the onClick event chain. No result.
Any advice, help, criticisms would be greatly appreciated
Thank you
Laxman Rana,修改在11 年前。
RE: Page freezes after download - unable to click button
Junior Member 帖子: 38 加入日期: 12-3-1 最近的帖子
hi,
have u got any solution??
have u got any solution??
Sagar A Vyas,修改在11 年前。