java - 404 on j_spring_security_check -


i trying use spring security create simple login system. when post login form, 404 on j_spring_security_check.

here's spring security:

<beans:beans xmlns="http://www.springframework.org/schema/security"          xmlns:beans="http://www.springframework.org/schema/beans"          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-4.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd">  <http use-expressions="true">     <intercept-url pattern="/dashboard/**" access="hasrole('role_user')" />     <form-login             login-page="/login"             default-target-url="/dashboard/home"             authentication-failure-url="/login?error"             username-parameter="username"             password-parameter="pass" />     <logout logout-success-url="/mp" />     <!-- enable csrf protection -->     <csrf/> </http>  <authentication-manager>     <authentication-provider>         <user-service>             <user name="user" password="secret" authorities="role_user" />         </user-service>     </authentication-provider> </authentication-manager> 

and login controller:

@controller public class logincontroller {  @requestmapping(value = "/login", method = requestmethod.get) public modelandview login(@requestparam(value = "error", required = false)   string error,                         @requestparam(value = "logout", required = false) string logout) { modelandview modelandview = new modelandview(); if (error != null) {   modelandview.addobject("error", "are sure got correct username/password...."); }  if (logout != null) {   modelandview.addobject("msg", "we sorry see go...."); }  modelandview.setviewname(views.login_view);  return modelandview;  } } 

and login view:

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>   <!doctype html> <html lang="en"> <head> <title>login</title> <!-- latest compiled , minified css --> <link rel="stylesheet"   href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"       integrity="sha384-1q8mtjoasx8j1au+a5wdvnpi2lkffwweaa8hdddjzlplegxhjvme1fgjwpgmkzs7"       crossorigin="anonymous">  <!-- optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"       integrity="sha384-flw2n01lmqjakbkx3l/m9eahuwpsfenvv63j5ezn3uzzapt0u7eysxmjqv+0en5r"       crossorigin="anonymous">  <!-- latest compiled , minified javascript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"         integrity="sha384-0msbjdehialfmubbqp6a4qrprq5ovfw37prr3j5elqxss1yvqotnepnhvp9aj7xs"         crossorigin="anonymous"></script>  <spring:url value="resources/styles/mundane.css" var="corecss" /> <c:url value="j_spring_security_check" var="loginurl" /> <link href="${corecss}" rel="stylesheet" /> </head> <body>  <c:if test="${not empty error}"> <div class="alert alert-danger" role="alert">     <strong>oh snap!</strong> ${error}. </div> </c:if>   <c:if test="${not empty msg}">   <div class="alert alert-danger" role="alert">     <strong>oh snap!</strong> ${msg}   </div>  </c:if>  <form name='loginform'   action="${loginurl}" method='post'> <fieldset class="form-group">     <label>username</label>     <input type="text" class="form-control" name="username" id="username" /> </fieldset> <fieldset class="form-group">     <label>password</label>     <input type="password" class="form-control" name="pass" id="pass" /> </fieldset> <input type="hidden" name="${_csrf.parametername}"        value="${_csrf.token}" /> <button type="submit" class="btn btn-lg btn-primary">login</button> </form> </body> </html> 


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -