I am getting "HTTP Status 405 - Request method 'POST' not supported" error message on clicking submit button in login form.
I am using Spring 3.0 security framework.
Please find below the code:
login.jsp
security-config.xmlCode:<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <c:if test="${param.login_error == 'true'}"> <font color="red">Your login attempt was not successful, please try again.<br /> Reason: <c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}" />. </font> </c:if> <form name="f" action="<c:url value='/j_spring_security_check'/>" method="POST"> <div> Username: <input id="j_username" type='text' name='j_username' style="width: 150px" /> </div> <br /> <div> Password: <input id="j_password" type='password' name='j_password' style="width: 150px" /> </div> <br /> <div> Remember me: <input id="_spring_security_remember_me" type='checkbox' name='_spring_security_remember_me' value='on' checked='checked' /> </div> <br /> <div> <a href="login_forgot.htm">forgot password</a> </div> <br /> <div> <input id="proceed" type="submit" value="Login" /> <input id="reset" type="reset" value="Reset" /> </div> </form> </div>
Code:<?xml version="1.0" encoding="UTF-8"?> <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.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"> <!-- HTTP security configurations --> <http auto-config="true" use-expressions="true"> <form-login login-processing-url="/j_spring_security_check" login-page="/login.htm" authentication-failure-url="/login.htm?login_error=t" default-target-url="/home" /> <logout logout-url="/logout" logout-success-url="/" /> <remember-me key="myAppKey" token-validity-seconds="864000" /> <!-- Configure these elements to secure URIs in your application --> <intercept-url pattern="/admin.htm" access="hasRole('ROLE_ADMIN')" /> </http> <!-- Configure Authentication mechanism --> <authentication-manager alias="authenticationManager"> <authentication-provider> <jdbc-user-service data-source-ref="dataSource" users-by-username-query="select NAME, PASSWORD, true from PERSON where NAME = ? and STATUS = 'Active'" authorities-by-username-query="select p.NAME, pr.AUTHORITY from PERSON p, PERSON_ROLE pr where p.PERSON_ID = pr.PERSON_ID and p.NAME = ? " /> </authentication-provider> </authentication-manager> </beans:beans>


Reply With Quote