易截截图软件、单文件、免安装、纯绿色、仅160KB

JSP中动态INCLUDE与静态INCLUDE的区别

JSP中有两种包含语句:
1. <%@include file="head.jsp" %>
2. <jsp:include page="head.jsp" />
   或者:
  <jsp:include page="jieshou.jsp">
   <jsp:param name="canshu" value="magci" />
   </jsp:include>
两种包含的区别:
1.<%@include file="uri" %>:先包含后处理
   a.不管被包含文件是静态还是动态,直接将页面中的全部内容包含进来;
   b.执行时先将包含进来的内容一起处理完之后再将所有的内容发给客户端。
2.<jsp:include page="uri" />:先处理后包含
   a.能自动区分被包含文件是静态还是动态;
   b.如果被包含文件是静态文件,处理方式跟第1种方式一样,
     如果是动态文件,则各自处理完之后把结果包含进来发给客户端。
实例:
被包含页面(inc.jsp):
<%
    int i=2; 
%>
<h1>inc.jsp:<%=i%></h1>
使用<%@include file="uri" %>包含:
<html>
  <head>
    <title>include1</title>
  </head>
  <body>
     <%
         int i=1; 
     %>
     <%@include file="inc.jsp" %>
     <h1>JSP:<%=i %></h1>
  </body>
</html>
使用<jsp:include page="uri" />包含:
<html>
  <head>
    <title>include2</title>
  </head>
  <body>
     <%
         int i=1; 
     %>
     <jsp:include page="inc.jsp" />
    &nb


相关文档:

JSP数据库连接疑问(Mysql)

package com.wxpn.tutorial.db;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.Date;
/**
 * 描述: 数据库连接池类
 * 
 * 
&n ......

jsp生成html静态页面代码

<%@ page contentType="text/html;charset=GBK"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*" %>
<%
//在这里如果写成“WEB-INF\templates\template.htm”程序会报错
 String filePath = request.getRealPath("/")+"WEB-INF/templates/template.htm"; &nbs ......

JSP文件

<%@ page language="java" import="kg.TestBean2;" %>
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>HelloBean</title>
</head>
<body>
<%--
<%
kg.TestBean2 testbean=(kg.TestBean2)session.setAttribute("testbean");
if ......

Ext+json+jsp构建的动态树

树节点组合模型
package cn.com.jsnh.model.catalog;
public class TreeModel {
private String node;
private CatalogModel model;
public String getNode() {
return node;
}
public void setNode(String node) {
this.node = node;
}
public CatalogModel getModel() {
return model;
}
public void setMo ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号