标签:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package com.lei; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public abstract class BaseServlet extends HttpServlet { /** * serialVersionUID属性概述 * */ private static final long serialVersionUID = 1L; public final void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // 记录访问日志 // 进行权限判断 if ( true ) // if条件里写的是“具有权限” { try { doService(request, response); } catch (IOException e) { // 记录异常信息 } } } protected abstract void doService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException; } |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package com.lei; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class MyServlet extends BaseServlet{ /** * serialVersionUID属性概述 * */ private static final long serialVersionUID = 1L; @Override protected void doService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // TODO Auto-generated method stub } } |
标签:
原文地址:http://www.cnblogs.com/huangshijie/p/4742776.html