📄 p1.jsp
字号:
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'p1.jsp' starting page</title>
</head>
<body>
<%
session.setAttribute("msgS","<B>Welcome,Session</B>");
session.setAttribute("score",789);
%>
${msgS };
<c:out value="${msgS}" escapeXml="false"></c:out><HR>
<c:if test="${score>=60}">
及格
</c:if>
<c:if test="${score<60}">
不及格
</c:if> <HR>
<c:choose>
<c:when test="${score>=90&&score<100}">优秀</c:when>
<c:when test="${score>=80&&score<90}">良好</c:when>
<c:when test="${score>=60&&score<80}">中等</c:when>
<c:when test="${score>=0&&score<60}">差</c:when>
<c:otherwise>输入错误</c:otherwise>
</c:choose><HR>
<%
//简单集合包括数组
ArrayList books = new ArrayList();
books.add("Struts");
books.add("Java");
session.setAttribute("books",books);
//集合里面有JavaBean
ArrayList cuses = new ArrayList();
cuses.add(new po.Customer("1111","1111"));
cuses.add(new po.Customer("2222","2222"));
session.setAttribute("cuses",cuses);
//JavaBean里面有集合
po.Customer cus = new po.Customer();
ArrayList phones = new ArrayList();
phones.add("435345");
phones.add("6574564");
cus.setPhones(phones);
session.setAttribute("cus",cus);
//复杂集合:HashMap
HashMap hm = new HashMap();
hm.put("driver","sunDriver");
hm.put("url","jdbc:odbc:School");
session.setAttribute("hm",hm);
session.setAttribute("message","111#222#444#333");
%>
<a href="p2.jsp?m=3&n=4">到达页面2</a>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -