<html xmlns="[url]http://www.w3.org/1999/xhtml[/url]">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
body{
margin:0;
font-size:12px;
height:100%;
}
#content {
position:absolute;
left:58%;
top:42%;
width:190px;
height:104px;
z-index:1;
}
.int{
width:120px;
height:13px;
border:#c0c0c0 1px solid;
}
.btn{padding-top:2px;}
</style>
</head>
<body>
<div id="content">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form method="post" action="j_security_check">
<tr>
<td height="25" colspan="2" align="right" valign="bottom"> </td>
</tr>
<tr>
<td width="60" height="35" align="right" valign="bottom">用户id:</td>
<td width="120" valign="bottom"><input type="text" name="j_username" id="j_username" class="int"/></td>
</tr>
<tr>
<td width="60" height="25" align="right" valign="bottom">密码:</td>
<td valign="bottom"><input type="password" name="j_password" id="j_password" class="int"/></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td height="30" colspan="2" align="right">
<input type="submit" id="btnok" value="登录" class="btn"/>
<input id="reset" type="reset" value="取消" class="btn"/></td>
</tr>
</form>
</table>
</div>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="601" height="364" border="0" align="center" cellpadding="0" cellspacing="0" background=\'#\'" /login.jpg">
<tr>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<html>
<head>
<title>
error
</title>
</head>
<body bgcolor="#ffffff">
<h1>
Login error!
</h1>
</body>
</html>
<web-resource-collection>
<web-resource-name>admin</web-resource-name>
<url-pattern>/admin/*</url-pattern>
<http-method>PUT</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<web-resource-collection>
<web-resource-name>pages</web-resource-name>
<url-pattern>/pages/*</url-pattern>
<http-method>PUT</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<web-resource-collection>
<web-resource-name>indexservlet</web-resource-name>
<url-pattern>/indexservlet</url-pattern>
<http-method>PUT</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<web-resource-collection>
<web-resource-name>index</web-resource-name>
<url-pattern>/index.jsp</url-pattern>
<http-method>PUT</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>mgr</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<role-name>mgr</role-name>
</security-role>
<role-name>mgr</role-name>
<principal-name>admin</principal-name>
</security-role-assignment>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
</login-config>
<welcome-file>/indexservlet</welcome-file>
</welcome-file-list>
private static final String CONTENT_TYPE = "text/html; charset=UTF-8";
public void init() throws ServletException {
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
response.setContentType(CONTENT_TYPE);
if (request.getUserPrincipal() != null) {
String userid = request.getUserPrincipal().getName();
Class cls = oper.getClass();
InvocationHandler ds = new OperProxy(oper);
IndexOperInterface operi = (IndexOperInterface) Proxy.
newProxyInstance(cls.getClassLoader(),
cls.getInterfaces(), ds);
UserQuery userquery = new UserQuery();
userquery.setUser_id(userid);
MenuItemList menulist = operi.getMenuItemList(user1);
WorkItemList worklist = operi.getWorkItemList(user1);
if (user1 != null) {
request.getSession().setAttribute("userid", user1.getUser_id());
request.getSession().setAttribute("username",
user1.getUser_name());
request.getSession().setAttribute("department",
user1.getUser_department());
}
if (menulist != null) {
request.getSession().setAttribute("menulistbean",
menulist.getMenulist());
}
if (worklist != null) {
request.getSession().setAttribute("worklistbean",
worklist.getWorkItemList());
}
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
doGet(request, response);
}
public void destroy() {
}
}
<welcome-file>/indexservlet</welcome-file>
</welcome-file-list>
private static final String CONTENT_TYPE = "text/html; charset=UTF-8";
public void init() throws ServletException {
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
response.setContentType(CONTENT_TYPE);
if (request.getUserPrincipal() != null) {
String userid = request.getUserPrincipal().getName();
Class cls = oper.getClass();
InvocationHandler ds = new OperProxy(oper);
IndexOperInterface operi = (IndexOperInterface) Proxy.
newProxyInstance(cls.getClassLoader(),
cls.getInterfaces(), ds);
UserQuery userquery = new UserQuery();
userquery.setUser_id(userid);
MenuItemList menulist = operi.getMenuItemList(user1);
WorkItemList worklist = operi.getWorkItemList(user1);
if (user1 != null) {
request.getSession().setAttribute("userid", user1.getUser_id());
request.getSession().setAttribute("username",
user1.getUser_name());
request.getSession().setAttribute("department",
user1.getUser_department());
}
if (menulist != null) {
request.getSession().setAttribute("menulistbean",
menulist.getMenulist());
}
if (worklist != null) {
request.getSession().setAttribute("worklistbean",
worklist.getWorkItemList());
}
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
doGet(request, response);
}
public void destroy() {
}
}