Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

flush.buffer  RSS feed

 
Raj kalaria
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

i have one requirment

I have one jsp page which has one button. now when you click that button it will call another JSP page which will call a function ( which is defined in a class)

now this function writefile will write my output to an excell sheet.

i collect the output in <html> and then use
out.print(buffer.toString())





now the problem is that .
when i click the button for the first time the excell sheet is not loaded , but if i click again the excell sheet will be laoded

now i thought flush.buffer will do my work

but can you tell me where should i write this
flush.buffer line

1)After my out.print(buffer.toString()) line in the function writefile
eg
public void writefile1(HttpServletResponse response, JspWriter out)throws IOException, DfException

buffer.append("</Table></body></html>");
out.print(buffer.toString());
response.flushBuffer();

-----------------------------------------------------------------


or in the JSP page
<%

SearchEx s = new SearchEx();
s.writefile1(response,out);
response.flushBuffer();

%>
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure why you're going through the process of writing to disk and then reading it back. If you don't need to and just want to stream the HTML and have it opened in Excel, there is a page in the JSP FAQ that shows how to do this.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!