掲示板
Page freezes after download - unable to click button
15年前 に Curtis Hayes によって更新されました。
Page freezes after download - unable to click button
New Member 投稿: 1 参加年月日: 08/04/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
11年前 に Laxman Rana によって更新されました。
RE: Page freezes after download - unable to click button
Junior Member 投稿: 38 参加年月日: 12/03/01 最新の投稿
hi,
have u got any solution??
have u got any solution??
11年前 に Sagar A Vyas によって更新されました。