配置文件如下<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:s="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"
default-autowire="byType" default-lazy-init="true"> <description>使用SpringSecurity的安全配置文件</description> <!-- http安全配置 -->
<s:http auto-config="true" access-decision-manager-ref="accessDecisionManager">
<s:form-login login-page="/login.jsp" default-target-url="/index.jsp" 
authentication-failure-url="/login.jsp?error=1" />
<s:logout invalidate-session="true" logout-success-url="/" />
<s:remember-me key="e37f4b31-0c45-11dd-bd0b-0800200c9a66" />
<!-- <s:intercept-url pattern="/**" requires-channel="https"/> -->   
</s:http> <!-- 认证配置 -->
<s:authentication-provider user-service-ref="userDetailsService">
<!--可设置hash使用sha1或md5散列密码后再存入数据库 -->
<s:password-encoder hash="sha" />
</s:authentication-provider> <!-- 项目实现的用户查询服务 -->
<bean id="userDetailsService" class="com.sonata.dashboard.service.security.UserDetailsServiceImpl" /> <!-- 授权判断配置, 将授权名称的默认前缀由ROLE_改为A_. -->
<bean id="accessDecisionManager" class="org.springframework.security.vote.AffirmativeBased">
<property name="decisionVoters">
<list>
<bean class="org.springframework.security.vote.RoleVoter">
<property name="rolePrefix" value="A_" />
</bean>
<bean class="org.springframework.security.vote.AuthenticatedVoter" />
</list>
</property>
</bean>
</beans>页面如下:
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>User Login</title>
<script type="text/javascript">
<c:if test="${param.error == '1'}">
document.onLoad = function(){
$.messager.alert('登录失败','用户名或者密码不正确!','error');
};
</c:if>
</script>
</head>
<body>
<center>
<form action="${pageContext.request.contextPath}/j_spring_security_check">
<table border="0">
   <tr>
  <td>USERNAME</td>
      <td><input type="text" name="j_username" id="j_username"/></td>
   </tr>
   <tr>
  <td>PASSWORD</td>
  <td><input type="password" name="j_password" id="j_password"/></td>
   </tr>
   <tr>
  <td align="center"><input type="submit" value="Submit"/></td>
  <td align="center"><input type="reset"/></td>
   </tr>
</table>
</form>
</center>
</body>
</html>
The webpage cannot be found 
 HTTP 404  
   Most likely causes:
•There might be a typing error in the address.
•If you clicked on a link, it may be out of date.
 
   What you can try: 
     Retype the address.  
 
     Go back to the previous page. 
 
     Go to  and look for the information you want.  
 
     
 
这样的错误  哪里出了问题