jsp¹ýÂËÆ÷Ö´ÐÐ˳Ðò
ÔÚÒ»¸ö´óÐÍÏîÄ¿ÖÐÍùÍùÓжà¸öservlet¹ýÂËÆ÷£¬µ«ÊÇÕâЩservlet¹ýÂËÆ÷µÄÖ´ÐÐ˳ÐòÊÇÔõÑùµÄÄØ£¿ ÏîÄ¿ÖйØÓÚSSH2ÖÐOpenSessionInViewFilterµÄѧϰÑо¿£¬²âÊÔFilterµÄÏȺó˳Ðò£¡£¡
Çë¿´Ò»ÏÂÀý×Ó£º
´´½¨Á½¸ö¼òµ¥µÄservletÎļþ
package 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;
public class Filter1 implements Filter {
public void destroy() {
}
public void init(FilterConfig config) throws ServletException {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
try {
System.out.println("filter1");
chain.doFilter(request, response);
System.out.println("filter1 go back");
} catch (Exception e) {
e.printStackTrace();
}
}
}
package 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;
public class Filter2 implements Filter {
public void destroy() {
}
public void init(FilterConfig config) throws ServletException {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
try {
System.out.println("filter2");
chain.doFilter(request, response);
System.out.println("filter2 go back");
} catch (Exception e) {
e.printStackTrace();
&n
Ïà¹ØÎĵµ£º
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="config/config_SelfHelp.jsp"%>
<%@ include file="sh_Bookmark_Data.jsp"%>
<html xmlns:v>
<head>
<title>ÎÒµÄÊéÇ©</title>
<style type="text/css">
tabl ......
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>strut ......
ÔÚÌÚ¿ÆÅàѵÁËÓÐ1¸ö°ëÔÂÁË£¬ÖÕÓÚѧÍêJSP+SERVLET+JAVABEAN+MYSQL£¬Ñ§ÁËjavaµÄµÚÒ»Ì×web½â¾ö·½°¸¡£ÀÏʦҪÇóÎÒÃÇ6ÈËÒ»×鿪ʼ×öÒ»¸ö¶©²Íϵͳ¡£Õâ¸öϵͳûÓÐʲôÌرðµÄ£¬¾Í¸úµç×ÓÉ̳ÇÊÇÒ»¸öÑùµÄ¡£ÓÉÓÚÒª¶ÔÊý¾Ý¿â×ö´óÁ¿µÄÔöɾ¸Ä²é£¬ÄǸö´úÂëÓֶ࣬ÎÒÏëÄܲ»Äܽ«Êý¾Ý¿â²Ù×÷µÄÕâÒ»²ã´ò°üÆðÀ´(SqlOperDao)£¬ÈÃÎÒ¶ÔÊý¾Ý¿â²Ù×÷£¬Óü¸Ðд ......
×î»ù±¾µÄÂÒÂëÎÊÌâ
Õâ¸öÂÒÂëÎÊÌâÊÇ×î¼òµ¥µÄÂÒÂëÎÊÌâ¡£Ò»°ãлá³öÏÖ¡£¾ÍÊÇÒ³Ãæ±àÂë²»Ò»Öµ¼ÖµÄÂÒÂë¡£
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=iso8859-1"%>
<html>
<head>
<title>ÖÐÎÄÎÊÌâ</title>
<meta http-equiv="Co ......
¶þÕßÇø±ðÊÇ£º
forwardʵ¼ÊÉÏÊÇÇëÇóÔÚ·þÎñÆ÷¶ËÌøת£¬ÇëÇó·½ÊǸÐÖª²»µ½ÕâÖÖÌøתµÄ£¬¶øsendRedirectÊÇÇëÇóÔÚ¿Í»§¶ËÌøת£¨±ÈÈçIE£©£¬µÈÓÚÔٴδӿͻ§¶Ë·¢ËÍÁËÒ»¸öÇëÇó£¬forwardÇé¿öÏÂÓû§ÔÚµØÖ·À¸ÀïÊÇ¿´²»µ½ÌøתºóµÄµØÖ·µÄ£¬sendRedirectÔò¿ÉÒÔ¿´µ½ÐµÄÇëÇóµØÖ·¡£ ......