我陷入了基本的JSP操作中。我想换一个新行,所以我在末尾添加了\ n,但它引发了异常。如果我删除\ n一切正常
例外
java.lang.IllegalArgumentException: Invalid LF not followed by whitespace
类文件
StringBuilder junitLog = new StringBuilder();
junitLog.append("The class that is being executed : " + description.getClassName() +"\n");
junitLog.append("Number of testcases to execute : " + description.testCount()+"\n");
/**
* @return the junitLog
*/
public StringBuilder getJunitLog() {
return junitLog;
}
/**
* @param junitLog the junitLog to set
*/
public void setJunitLog(StringBuilder junitLog) {
this.junitLog = junitLog;
}
JSP:-
response.setHeader("finalJUNITReport",""+ junitListener.getJunitLog());
最佳答案
在设置头文件之前,请先尝试对它们进行Base64编码,然后在想回读它们时对Base64进行解码。