• Post Reply Bookmark Topic Watch Topic
  • New Topic

The response has already been commited.

 
arada theera
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I click print or export button , I get this error: com.crystaldecisions.report.web.viewer.CrystalReportViewer
The response has already been commited.

How to solve this error ?

--------------code------------------------------------------------
<%@ page import= "java.net.*,
com.crystaldecisions.sdk.occa.report.data.*,
com.crystaldecisions.report.web.*,
com.crystaldecisions.sdk.occa.report.application.*,
com.crystaldecisions.sdk.occa.report.reportsource.*,
com.crystaldecisions.report.web.viewer.*,
com.crystaldecisions.sdk.occa.report.lib.*"

%>
<%@ page contentType="text/html; charset=TIS-620" %>
<%!
String TblType;
String RptName;
%>
<%
try{


TblType=request.getParameter("saletype");
RptName=TblType+".rpt";

ReportServerControl serverControl = new ReportServerControl();

com.crystaldecisions.sdk.occa.report.data.ConnectionInfos connInfos = null;
connInfos=new com.crystaldecisions.sdk.occa.report.data.ConnectionInfos();

String tmpPath = "C:\\Program Files\\Crystal Decisions\\Crystal Reports 9\\Templates";
String rptPath = "C:\\Program Files\\Crystal Decisions\\Report Application Server 9\\Reports";

System.setProperty("ras.config", "C:\\Program Files\\Common Files\\Crystal Decisions\\2.0\\jars");


ReportClientDocument cd2 = new ReportClientDocument();
cd2.open(rptPath + "\\" + RptName, 0);


serverControl.setReportSource(cd2.getReportSource());

serverControl.setEnableLogonPrompt(false);
serverControl.processHttpRequest(request, response, getServletConfig().getServletContext(), out);
connInfos = serverControl.getDatabaseLogonInfos();

int size = connInfos.size();// Get size of collection
for (int x=0; x<size; x++)
{
com.crystaldecisions.sdk.occa.report.data.IConnectionInfo iConnInfo = connInfos.getConnectionInfo(x);
iConnInfo.setUserName("user");
iConnInfo.setPassword("password");
}
com.crystaldecisions.report.web.viewer.CrystalReportViewer tc1 = null;
tc1 = new com.crystaldecisions.report.web.viewer.CrystalReportViewer() ;
tc1.setReportSource(cd2.getReportSource());

tc1.setDatabaseLogonInfos(connInfos);
tc1.setEnableLogonPrompt(false);
tc1.processHttpRequest(request, response, getServletConfig().getServletContext(), out);
tc1.dispose();
cd2.close();

}
catch( Exception e)
{
e.printStackTrace();
}

%>
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems likely that this call:

does some action with the response that is causing the error. Probably the method you are calling expects to have total control over the request and response.
Your code is an example of why it is bad practice to use JSP for complex operations that would be better performed in a servlet.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!