include 可以直接load入文件,不能可以动态增加内容,动态赋值变量,效率高;
jsp:include 也可以load入文件,同时可以动态增加内容,动态赋值变量等.效率低;被包含的对象只有对JSP write对象的访问权,并且它不能设置头或者Cookie.如果页面输出是缓冲的,那么缓冲区的刷新要优于包含的刷新.
jsp:forward 则是直接跳转页面,并能设置变量
[@more@]应用例子:
static.html:
static.html
please input your name: |
input yor password: |
===================
two.jsp:
two.jsp
this is a1 =
this is a2 =
=====================
jsp_include.jsp:
goto two-->
this examples show include works
String name = request.getParameter("namet");
out.print("
"+name);
String password = request.getParameter("passwordt");
out.print("
"+password);
if(null == name) name = "null";
if(password == null) password = "null";
%>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/640706/viewspace-1016584/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/640706/viewspace-1016584/