20151113--JSTL

时间:2022-07-22 21:16:13
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>测试JSTL (Java标准标签库)</title>
</head>
<body>
<%
//session.setAttribute("test", "测试内容");
//request.setAttribute("test", "测试内容2");
//application.setAttribute("test", "测试内容3"); com.hanqi.dao.User user1 = new com.hanqi.dao.User();
request.setAttribute("user1", user1); //session.setAttribute("user1", user1);
%>
<c:catch var="error"></c:catch>
<c:out value="${error }"/>
<c:remove var="user1" scope="session"/> <c:set var="test" value="标签测试内容" scope="request"/>
<jsp:useBean class="com.hanqi.dao.User" id="user" />
<c:set target="${user1 }" property="username" value="测1试用户123" /> <c:out value="${user1.username }"></c:out>
<c:out value="${user1.getUsername() }"></c:out> <br>
<c:out value=" ${test }<hr>" escapeXml="true" default="默认值"></c:out>
<%=
"你好2 <hr>"
%> ${
"你好3<hr>"
} <%
out.print("你好4<hr>");
out.write("你好5 &lt hr &gt");
%> </body>
</html>

1

20151113--JSTL

相关文章