Java Web學(xué)習(xí)筆記,顯示面板loadonstartup servlet實(shí)操,緩存,監(jiān)聽器【詩(shī)書畫唱】



學(xué)習(xí)筆記:
一、監(jiān)聽器Listener:
其實(shí)就是一個(gè)java類。
1、監(jiān)聽Session、request和application的創(chuàng)建和銷毀
HttpSessionListener,ServletContextListener,ServletRequestListener
2、監(jiān)聽對(duì)象屬性變化
HttpSessionAttributeListener,ServletContextAttributeListener,ServletRequestAttributeListener
3、監(jiān)聽Session內(nèi)的對(duì)象
HttpSessionBindingListener,HttpSessionActivationListener
監(jiān)聽器Listener跟js中的事件一樣:
項(xiàng)目一啟動(dòng)就要打印一句Hello world
方法一:使用loadonstartup servlet可以實(shí)現(xiàn)
方法二:使用Listener實(shí)現(xiàn),當(dāng)項(xiàng)目啟動(dòng)時(shí)馬上運(yùn)行代碼
ServletContextListener用來(lái)監(jiān)控application對(duì)象的創(chuàng)建和銷毀的監(jiān)聽器
當(dāng)啟動(dòng)一個(gè)javaweb項(xiàng)目時(shí),會(huì)創(chuàng)建唯一的一個(gè)application對(duì)象
servlet,filter和listener都需要在web.xml文件中進(jìn)行配置。
創(chuàng)建listener的步驟:
1、創(chuàng)建listener類
2、在web.xml文件中進(jìn)行配置
代碼緩存時(shí)可以使用監(jiān)聽器:ServletContextListener
統(tǒng)計(jì)本網(wǎng)頁(yè)的訪問次數(shù)。
統(tǒng)計(jì)在線人數(shù)。(必須使用HttpSessionListener,用來(lái)監(jiān)視session對(duì)象的創(chuàng)建和銷毀的)
"ServletRequestAttributeListener:當(dāng)調(diào)用request對(duì)象的setAttribute方法時(shí),會(huì)
運(yùn)行這個(gè)監(jiān)聽器中的代碼"
角色和權(quán)限:
不同的角色登錄到系統(tǒng)中看到的內(nèi)容是不一樣的,這個(gè)就叫權(quán)限問題。
實(shí)際操作例子記錄:
創(chuàng)建Java Web和loadonstartup servlet的方法:







創(chuàng)建Java Web和Listener監(jiān)聽器的方法:


































綜合效果的例子:

package com.jy.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
?* Servlet implementation class TestServlet
?*/
@WebServlet("/ts")
public class TestServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
? ? ? ?
? ? /**
? ? ?* @see HttpServlet#HttpServlet()
? ? ?*/
? ? public TestServlet() {
? ? ? ? super();
? ? ? ? // TODO Auto-generated constructor stub
? ? }
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
this.doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
//往request對(duì)象中添加了一個(gè)act屬性
request.setAttribute("act", "admin");
request.setAttribute("pwd", 123);
//將request對(duì)象中的act屬性移除掉
//request.removeAttribute("act");
request.setAttribute("act", "Tom");
}
}


package com.jy.listener;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
//專門用來(lái)監(jiān)視application對(duì)象的創(chuàng)建和銷毀的類
public class CtxListener implements ServletContextListener {
? ? //當(dāng)application對(duì)象被創(chuàng)建出來(lái)時(shí)調(diào)用的方法
@Override
public void contextInitialized(ServletContextEvent arg0) {
// TODO Auto-generated method stub
? ? ? ? //進(jìn)行代碼的緩存
String html = "<select><option>請(qǐng)選擇</option><option>高中</option><option>大專</option><option>本科</option></select>";
//獲取application對(duì)象
ServletContext application = arg0.getServletContext();
//將下拉框數(shù)據(jù)存到application對(duì)象中
application.setAttribute("edu", html);
String sex = "<input type='radio' name='sex' value='男' />男<input type='radio' name='sex' value='女' />女";
application.setAttribute("sex", sex);
}
? ? //當(dāng)application對(duì)象被銷毀時(shí)調(diào)用的方法
@Override
public void contextDestroyed(ServletContextEvent arg0) {
// TODO Auto-generated method stub
}
}


package com.jy.listener;
import javax.servlet.ServletRequestAttributeEvent;
import javax.servlet.ServletRequestAttributeListener;
public class ReqAttrListener implements ServletRequestAttributeListener {
? ? //當(dāng)往request對(duì)象中添加一個(gè)屬性時(shí)會(huì)執(zhí)行這個(gè)方法
@Override
public void attributeAdded(ServletRequestAttributeEvent arg0) {
// TODO Auto-generated method stub
//獲取修改的屬性的名字
String name = arg0.getName();
//獲取修改的屬性的具體的值
Object value = arg0.getValue();
? ? ? ? System.out.println("你往request對(duì)象中添加了一個(gè)屬性,屬性名是:" + name);
}
? ? //當(dāng)移除掉request對(duì)象中的一個(gè)屬性時(shí)會(huì)執(zhí)行這個(gè)方法
@Override
public void attributeRemoved(ServletRequestAttributeEvent arg0) {
// TODO Auto-generated method stub
? ? ? ? System.out.println("你移除掉了reuqest對(duì)象中的一個(gè)屬性");
}
? ? //當(dāng)替換掉request對(duì)象中的一個(gè)屬性時(shí)會(huì)執(zhí)行這個(gè)方法
@Override
public void attributeReplaced(ServletRequestAttributeEvent arg0) {
// TODO Auto-generated method stub
System.out.println("你替換掉了request對(duì)象中的一個(gè)屬性");
}
}


package com.jy.listener;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
public class SsListener implements HttpSessionListener {
? ? //當(dāng)創(chuàng)建session對(duì)象時(shí)調(diào)用
@Override
public void sessionCreated(HttpSessionEvent arg0) {
// TODO Auto-generated method stub
? ? ? ? //System.out.println("有用戶上線啦");
? ? ? ? //設(shè)置session在多久以后會(huì)失效,也就是多久以后會(huì)被銷毀
? ? ? ? //設(shè)置3秒以后被銷毀掉
? ? ? ? arg0.getSession().setMaxInactiveInterval(3);
ServletContext application = arg0.getSession().getServletContext();
//嘗試從application對(duì)象中取出在線人數(shù)
Object objTotal = application.getAttribute("total");
if(objTotal == null) {//第一個(gè)上線的用戶
application.setAttribute("total", 1);
}else {
Integer total = Integer.parseInt(objTotal.toString());
total ++;
application.setAttribute("total", total);
}
}
? ? //當(dāng)銷毀session對(duì)象時(shí)調(diào)用
@Override
public void sessionDestroyed(HttpSessionEvent arg0) {
// TODO Auto-generated method stub
? ? ? ? //System.out.println("這個(gè)用戶下線啦");
ServletContext application = arg0.getSession().getServletContext();
Object objTotal = application.getAttribute("total");
if(objTotal != null) {
Integer total = Integer.parseInt(objTotal.toString());
total --;
application.setAttribute("total", total);
}
}
}


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
? <display-name>listenerJavaWeb</display-name>
? <listener>
? ? <listener-class>com.jy.listener.CtxListener</listener-class>
? </listener>
? <listener>
? ? <listener-class>com.jy.listener.SsListener</listener-class>
? </listener>
? <listener>
? ? <listener-class>com.jy.listener.ReqAttrListener</listener-class>
? </listener>
? <welcome-file-list>
? ? <welcome-file>index.html</welcome-file>
? ? <welcome-file>index.htm</welcome-file>
? ? <welcome-file>index.jsp</welcome-file>
? ? <welcome-file>default.html</welcome-file>
? ? <welcome-file>default.htm</welcome-file>
? ? <welcome-file>default.jsp</welcome-file>
? </welcome-file-list>
</web-app>


<%@ page language="java" contentType="text/html;?
charset=UTF-8" pageEncoding="UTF-8"%>
<%
? ? String path = request.getContextPath();
? ? String basePath = request.getScheme()+"://"
? ? +request.getServerName()+":"+request.getServerPort()+path+"/";
? ??
? ? //嘗試從application中獲取訪問次數(shù)
? ? Object objCt = application.getAttribute("ct");
? ? if(objCt == null) {//第一次訪問本頁(yè)面
? ? application.setAttribute("ct", 1);
? ? }else {
? ? Integer count = Integer.parseInt(objCt.toString());
? ? count ++;
? ? application.setAttribute("ct", count);
? ? }
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
? ? <head>
? ? ? ? <base hreff="<%=basePath%>">
? ? ? ? <title></title>
? ? ? ? <meta http-equiv="pragma" content="no-cache">
? ? ? ? <meta http-equiv="cache-control" content="no-cache">
? ? ? ? <meta http-equiv="expires" content="0">
? ? ? ? <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
? ? ? ? <meta http-equiv="description" content="This is my page">
? ? </head>
? ? <body>
? ? ? ? <h1>首頁(yè),訪問次數(shù):${ct }</h1>
? ? ? ? ${edu }
? ? ? ? ${sex }
? ? ? ? <h1>當(dāng)前在線人數(shù):${total }</h1>
? ? </body>
</html>


<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
? ? String path = request.getContextPath();
? ? String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
? ? <head>
? ? ? ? <base hreff="<%=basePath%>">
? ? ? ? <title></title>
? ? ? ? <meta http-equiv="pragma" content="no-cache">
? ? ? ? <meta http-equiv="cache-control" content="no-cache">
? ? ? ? <meta http-equiv="expires" content="0">
? ? ? ? <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
? ? ? ? <meta http-equiv="description" content="This is my page">
? ? </head>
? ? <body>
? ? ? ? <h1>登錄頁(yè)面</h1>
? ? ? ? ${edu }
? ? </body>
</html>




作業(yè):
1、通過監(jiān)聽器實(shí)現(xiàn)在線人數(shù)統(tǒng)計(jì)。


package com.SSHC.listener;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
public class OnlineListener implements HttpSessionListener {
@Override
public void sessionCreated(HttpSessionEvent arg0) {
? ? ? ? arg0.getSession().setMaxInactiveInterval(3);
ServletContext application =?
arg0.getSession().getServletContext();
Object objTotal = application.getAttribute("total");
if(objTotal == null) {
application.setAttribute("total", 1);
}else {
Integer total = Integer.parseInt(objTotal.toString());
total ++;
application.setAttribute("total", total);
}
}
@Override
public void sessionDestroyed(HttpSessionEvent arg0) {
ServletContext application =?
arg0.getSession().getServletContext();
Object objTotal = application.getAttribute("total");
if(objTotal != null) {
Integer total = Integer.parseInt(objTotal.toString());
total --;
application.setAttribute("total", total);
}
}
}


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
? <display-name>JavaWebListener</display-name>
? <listener>
? ? <listener-class>com.SSHC.listener.OnlineListener</listener-class>
? </listener>
? <welcome-file-list>
? ? <welcome-file>index.html</welcome-file>
? ? <welcome-file>index.htm</welcome-file>
? ? <welcome-file>index.jsp</welcome-file>
? ? <welcome-file>default.html</welcome-file>
? ? <welcome-file>default.htm</welcome-file>
? ? <welcome-file>default.jsp</welcome-file>
? </welcome-file-list>
</web-app>


<%@ page language="java" contentType="text/html;?
charset=UTF-8" pageEncoding="UTF-8"%>
<%
? ? String path = request.getContextPath();
? ? String basePath = request.getScheme()+"://"
? ? +request.getServerName()+":"+request.getServerPort()+path+"/";
? ??
? ? //嘗試從application中獲取訪問次數(shù)
? ? Object objCt = application.getAttribute("ct");
? ? if(objCt == null) {//第一次訪問本頁(yè)面
? ? application.setAttribute("ct", 1);
? ? }else {
? ? Integer count = Integer.parseInt(objCt.toString());
? ? count ++;
? ? application.setAttribute("ct", count);
? ? }
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
? ? <head>
? ? ? ? <base hreff="<%=basePath%>">
? ? ? ? <title></title>
? ? ? ? <meta http-equiv="pragma" content="no-cache">
? ? ? ? <meta http-equiv="cache-control" content="no-cache">
? ? ? ? <meta http-equiv="expires" content="0">
? ? ? ? <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
? ? ? ? <meta http-equiv="description" content="This is my page">
? ? </head>
? ? <body>
? ? ? ? <h1>詩(shī)書畫唱提醒你!</h1>
? ? ??
? ? ? ? <h1>當(dāng)前在線人數(shù):${total }</h1>
? ? </body>
</html>


2、在項(xiàng)目啟動(dòng)時(shí)將下拉框中的數(shù)據(jù)緩存起來(lái),必須連接數(shù)據(jù)庫(kù),在不同的jsp頁(yè)面創(chuàng)建下拉框載入緩存數(shù)據(jù)。

create table studentInfo(
sid int primary key auto_increment,
sname varchar(100) not null,
sgender varchar(100)? default '男' not null,
sage int not null,
saddress varchar(100) ,
semail? varchar(100) );
insert into? studentInfo(
sname ,
sgender ,
sage ,
saddress ,
semail?
) values ("詩(shī)書畫唱1",'男','19','北京市朝陽(yáng)區(qū)','SSHC1@163. com'),
("詩(shī)書畫唱2",'男','20','北京市朝陽(yáng)區(qū)','SSHC2@163. com'),
("詩(shī)書畫唱3",'男','30','北京市朝陽(yáng)區(qū)','SSHC3@163. com');
--drop table studentDB
--select * from studentDB




package bean;
public class studentInfo {
? ? private Integer? ?sid ;
? ? private? String? sname;
? ? private? String? ? sgender ;
? ? private Integer? ?sage ;
? ? private? String saddress;
? ? private? String? semail;
public Integer getSid() {
return sid;
}
public void setSid(Integer sid) {
this.sid = sid;
}
public String getSname() {
return sname;
}
public void setSname(String sname) {
this.sname = sname;
}
public String getSgender() {
return sgender;
}
public void setSgender(String sgender) {
this.sgender = sgender;
}
public Integer getSage() {
return sage;
}
public void setSage(Integer sage) {
this.sage = sage;
}
public String getSaddress() {
return saddress;
}
public void setSaddress(String saddress) {
this.saddress = saddress;
}
public String getSemail() {
return semail;
}
public void setSemail(String semail) {
this.semail = semail;
}
? ?
}

package com.SSHC.controller;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import bean.studentInfo;
import DAO.Dao;
@WebServlet("/FirstPageServletStart")
public class FirstPageServletStart extends HttpServlet {
private static final long serialVersionUID = 1L;
??
? ? public FirstPageServletStart() {
? ? ? ? super();
? ? ? ? // TODO Auto-generated constructor stub
? ? }
/**
* @see HttpServlet#doGet(HttpServletRequest request,
*? HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request,?
HttpServletResponse response)?
throws ServletException, IOException {
// TODO Auto-generated method stub
this.doPost(request, response);
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response)?
throws ServletException, IOException {
Dao gd = new Dao();
List<studentInfo>list = gd.selectAll();
StringBuilder html = new StringBuilder();
boolean panDuan=true;
//奇數(shù)行為class='false'
for(studentInfo g : list) {
Integer Sid= g.getSid();
String Sname= g.getSname();
String Saddress= g.getSaddress();
String Sgender= g.getSgender();
String Semail= g.getSemail();
Integer Sage= g.getSage();
panDuan=!panDuan;
html.append("<tr class='"+panDuan+"'>");
html.append("<td ><a href='IDSelectServlet?Osid="
+Sid+"'>"?
+ Sid + "</a></td>");
? html.append("<td >" + Sname + "</td>");
html.append("<td >" + Sgender+ "</td>");
?html.append("<td>" + Sage + "</td>");
html.append("<td >" +Saddress + "</td>");
html.append("<td >" + Semail + "</td>");
? ? ? ? html.append("</tr>");
}
request.setAttribute("html", html);
request.getRequestDispatcher("firstPage.jsp")
? ? .forward(request, response);
}
}

package com.SSHC.Filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
@WebFilter("/*")
public class CodeFilter implements Filter {
? ?
? ? public CodeFilter() {
? ? ? ? // TODO Auto-generated constructor stub
? ? }
public void destroy() {
// TODO Auto-generated method stub
}
public void doFilter(ServletRequest request,?
ServletResponse response, FilterChain chain)
throws IOException, ServletException {
// TODO Auto-generated method stub
// place your code here
request.setCharacterEncoding("utf-8");
chain.doFilter(request, response);
}
public void init(FilterConfig fConfig) throws ServletException {
// TODO Auto-generated method stub
}
}

package com.SSHC.listener;
import java.util.List;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import DAO.Dao;
import bean.studentInfo;
public class huanCunListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent arg0) {
Dao gd = new Dao();
List<studentInfo>list = gd.selectAll();
StringBuilder html = new StringBuilder();
html.append("<select><option>請(qǐng)選擇</option>");
boolean panDuan=true;
//奇數(shù)行為class='false'
for(studentInfo g : list) {
String Sname= g.getSname();
html.append("<option>"+Sname+"</option>"
);
}
html.append("</select>");
ServletContext application = arg0.getServletContext();
System.out.println(html);
application.setAttribute("XLK", html);
}
@Override
public void contextDestroyed(ServletContextEvent arg0) {
// TODO Auto-generated method stub
}
}

package DAO;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import utils.DBUtils;
import bean.studentInfo;
public class Dao {
public List<studentInfo>selectAll(){
String sql = "select * from studentInfo";
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<studentInfo>list = new ArrayList<studentInfo>();
try {
conn = DBUtils.getConn();
pstm = conn.prepareStatement(sql);
rs = pstm.executeQuery();
while(rs.next()) {
Integer sid = rs.getInt("sid");
String Saddress = rs.getString("Saddress");
String Sname = rs.getString("Sname");
String Sgender= rs.getString("Sgender");
String semail = rs.getString("semail");
Integer sage = rs.getInt("sage");
studentInfo g = new studentInfo();
g.setSid(sid);
g.setSage(sage);
g.setSgender(Sgender);
g.setSemail(semail);
g.setSname(Sname);
g.setSaddress(Saddress);
list.add(g);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
?
}

package utils;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties;
public class DBUtils {
? ? private static String driverName;
? ? private static String url;
? ? private static String userName;
? ? private static String pwd;
? ? //靜態(tài)塊,隨著類加載而運(yùn)行的
? ? static{
? ? //讀取db.properties文件中的內(nèi)容:
? ? Properties prop = new Properties();
? ? InputStream is = DBUtils.class.getClassLoader()
? ? .getResourceAsStream("db.properties");
? ? try {
prop.load(is);
driverName = prop.getProperty("dn");
url = prop.getProperty("url");
userName = prop.getProperty("un");
pwd = prop.getProperty("up");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
? ? }
? ??
? ? public static Connection getConn(){
? ? Connection conn = null;
? ? try {
Class.forName(driverName);
conn = DriverManager.getConnection(url,userName,pwd);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
? ? return conn;
? ? }
? ??
? ? public static void close(ResultSet rs,
? ? PreparedStatement pstm
? ? ,Connection conn){
? ? try {
? ? if(rs != null) {
? ? rs.close();
? ? }
? ? if(pstm != null) {
? ? pstm.close();
? ? }
? ? if(conn != null) {
? ? conn.close();
? ? }
? ? } catch(Exception e) {
? ? e.printStackTrace();
? ? }
? ? }
}

dn=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/studentdb?useUnicode=true&characterEncoding=UTF-8
un=root
up=root

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
xmlns="http://java.sun.com/xml/ns/javaee"?
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee?
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"?
id="WebApp_ID" version="3.0">
? <display-name>JavaWebListener</display-name>
? <listener>
? ? <listener-class>com.SSHC.listener.OnlineListener</listener-class>
? </listener>
? <listener>
? ? <listener-class>com.SSHC.listener.huanCunListener</listener-class>
? </listener>
? <welcome-file-list>
? ? <welcome-file>index.html</welcome-file>
? ? <welcome-file>index.htm</welcome-file>
? ? <welcome-file>index.jsp</welcome-file>
? ? <welcome-file>default.html</welcome-file>
? ? <welcome-file>default.htm</welcome-file>
? ? <welcome-file>default.jsp</welcome-file>
? </welcome-file-list>
</web-app>

<%@ page language="java" contentType="text/html; charset=UTF-8"
? ? pageEncoding="UTF-8"%>
<!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>詩(shī)書畫唱</title>
</head>
<body>
${XLK}
</body>
</html>

<%@ page language="java" contentType="text/html; charset=UTF-8"
? ? pageEncoding="UTF-8"%>
<!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>詩(shī)書畫唱</title>
</head>
<body>
${XLK}
</body>
</html>


Java Web學(xué)習(xí)筆記,顯示面板loadonstartup servlet實(shí)操,緩存,監(jiān)聽器【詩(shī)書畫唱】的評(píng)論 (共 條)
