include和jsp:include
index.jsp:
<html>
<head>
<title>The News</title>
</head>
<body>
<h1> Latest News</h1>
<table>
<tr>
<td><h3><%@include file="items/news1.jsp" %></h3></td>
</tr>
<tr>
<td><h3><jsp:include page="items/news1.jsp"/></h3></td>
</tr>
</table>
</body>
</html>
items/news1.jsp:
Sharks attacked <%@ include file="news2.jsp" %>, <jsp:include page="news2.jsp"/> survived!
items/news2.jsp:
swimmers
news2.jsp:
nobody
index.jsp输出:
Latest News
Sharks attacked swimmers, nobody survived!
Sharks attacked swimmers, swimmers survived!
<% @include %>指令在翻译阶段会把页面包含进来,<jsp:include>动作则在请求时执行。
相关文档:
JSP文件下载-----------------------------------------------------------------
<%@ page contentType="text/html; charset=GBK"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="java.io.File"%>
<%@page import="java.io.InputStream"%>
<%@page ......
错误:
String realPath = " http:// " + request.getServerName() + " : " + request.getServerPort() + request.getContextPath();
String realPath = " http:// " + request.getSer ......
第一种采用预编译语句集,它内置了处理SQL注入的能力,只要使用它的setString方法传值即可:
String sql= "select * from users where username=? and password=?;
PreparedStatement preState = conn.prepareStatement(sql);
preState.setString(1, userName);
preState.setString(2, password);
ResultSet rs = ......
关于JSP中org.apache.jasper.JasperException:
This absolute uri http://java.sun.com/jsp/jstl/core ) cannot be resolved in either web.xml or the jar files deployed with this application
从网上搜了一下,相同的说法是:一个就是JSTL的版本问题(1.0与1.1),是否不一致 ......