1
を使用していますが、私は何が起こっているかを取得しておりませんjava.lang.IllegalStateException
cannot forward. response already committed jsp.
java.lang.illegalstateexceptionは転送できません。私は、JSPの下に応答すでにコミットJSP
を取得しますか?なぜこれらの例外を与えているのですか?
私はたくさん試しました。問題を解決するのを手伝ってください。
String contentType = request.getContentType();
InputStream tmpInStream =null ;
DataInputStream myInput = null;
boolean isMultipartContent = ServletFileUpload.isMultipartContent(request);
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
try
{
List fields = upload.parseRequest(request);
Iterator it = fields.iterator();
while (it.hasNext())
{
FileItem fileItem = (FileItem)it.next();
boolean isFormField = fileItem.isFormField();
if (isFormField==false)
{
fileName=fileItem.getName();
log.printOut("[Upload] (When form field is false) FileName: " + fileItem.getName() + " SIZE (BYTES): " + fileItem.getSize());
tmpInStream = fileItem.getInputStream();
myInput = new DataInputStream(tmpInStream);
String tmpCSVData = fileItem.getString();
}
else
{
log.printOut("[Upload] (When form field is true) FileName: " + fileItem.getName() + " SIZE (BYTES): " + fileItem.getSize());
csv = fileItem.getString();
}
}
}
catch (Exception e)
{
log.printErr("[Upload] Error while getting file :"+ e);
}
String thisLine;
XMLParser xmlParser = new XMLParser();
String InputXml="";
String OutputXml="";
String csvType="";
try{
Properties properties = new Properties();
properties.load(new FileInputStream(System.getProperty("user.dir")+File.separator+"ips.properties"));
String Ipsviewname=properties.getProperty("CsvIpsViewName");
String Tranviewname=properties.getProperty("CsvTransViewName");
log.printOut("[Upload] TableName (IPS)"+ Ipsviewname);
log.printOut("[Upload] TableName (Transaction)"+ Tranviewname);
while ((thisLine = myInput.readLine()) != null)
{
String strar[] = thisLine.split(",");
log.printOut("[Upload] Line Split length "+ strar.length);
if(strar.length!=11 && strar.length!=5)
{
RequestDispatcher rd = request.getRequestDispatcher("DownloadDocs.jsp?result=Invalid CSV");
rd.forward(request, response);
}
if(strar.length==11)
{
csvType="ips";
}
else
{
csvType="Transaction";
}
log.writeXML("[Upload] INPUTXML "+ InputXml);
OutputXml = sessionBean.execute(InputXml);
log.writeXML("[Upload] OUTPUTXML "+ OutputXml);
xmlParser.setInputXML(OutputXml);
}
request.setAttribute ("page","upload");
request.setAttribute ("file", fileName);
RequestDispatcher rd = request.getRequestDispatcher("csvtabl.jsp?csvType="+csvType+"");
rd.forward(request, response);
}
catch (Exception e)
{
RequestDispatcher rd =request.getRequestDispatcher("DownloadDocs.jsp?result=Invalid CSV");
rd.forward(request, response);
log.printErr("[Upload] Error while reading file :"+ e);}