1、这个jsp文件是前后都不能有空格及其他的语句。
<%
response.getWriter();
RequestDispatcher rd = application
.getRequestDispatcher("/JiuBiao.html");
rd.forward(request, response);
%>
2、写的page文件:
<%@ page contentType="text/html" pageEncoding="GB2312"%>
<%
PageContext lastpageContext = null;
int count = 0;
%>
<%
if (count != 0) {
if (lastpageContext == pageContext) {
out.println("本次与上次的pageContext对象相同<br>");
} else {
out.println("本次与上次的pageContext对象不同<br>");
}
String x = (String) pageContext.getAttribute("x");
if ("abc".equals(x)) {
out.println("获取本次pageContext的属性值<br>");
} else {
out.println("没有获取本次的pageContext的属性值<br>");
}
}
lastpageContext = pageContext;
pageContext.setAttribute("x", new String("abc"));
count++;
System.out.println(count);
%>
3、java.lang.IllegalStateException异常发生的原因:
因为Application Server在处理编译jsp时对于<%和%>之间的内容通过PrintWriter输出(包括HTML标签,空格,回车等通过浏览器生成的标识符),但是jsp文件内容又要进行流输出:ServletOutputStream,这样做相当于试图在Servlet中使用两种输出机制,就会发生java.lang.IllegalStateException异常。
4、jsp九大隐式对象