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
相关文档:
<%@ 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连接Oracle8/8i/9i数据库(用thin模式)
testoracle.jsp如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Stri ......
JSP基本语法与定义
先来看一段简单的小程序:
程序:
1.jsp
<html>
<head>
<title>example</title>
</head>
1
<%@ page language=”java” %>
2
<%@ page
contentType=”text/html,charset=”GB2312””>
3
......
这是一个用户注册的页面,部分代码(没有错误)已略,可是不能实现form的action跳转
checkform()里明明有document.form.submit(),就是不能跳转,
能帮我看下问题出在哪吗?
这是照着书上的例子写的,注册和重置动都作是通过图片来处理的。
请不吝赐教,在下不胜感激。。。
<%@ page contentType="te ......
以前有提到过乱码问题,最近在使用window.open时又出现此类问题,现解决如下:
1:使用encodeURIComponent函数对参数进行处理,例如:window.open("html.jsp?name=" + encodeUrlComponent(value)));
2:修改tomcat服务器的server.xml文件添加:useBodyEncodingForURI="true"或者
URIEncoding=" ......