Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8540939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:42:43+00:00 2026-06-11T11:42:43+00:00

I’m trying to set up spring security, I have a controller which forwards to

  • 0

I’m trying to set up spring security, I have a controller which forwards to a login page after valdiation failure. But my interecept does not seem to pick it up…

Contoller fragment:

if (validation not successful) {
   return "login";
}

In my xml I have:

<security:intercept-url pattern="/login*" access="ROLE_USER" /> 

but this fails, I get the following error:

The requested resource (/myapp/WEB-INF/jsp/login.jsp) is not available.

How can I get it to interecept the login forward?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:42:44+00:00Added an answer on June 11, 2026 at 11:42 am

    If user is not logged yet, it means he doesn’t have ROLE_USER, so Spring Security won’t allow to access /login.

    Add use-expressions="true" to <http> element and change intercept line to this:

    <http use-expressions="true">
      <!-- ... -->
      <security:intercept-url pattern="/login*" access="permitAll" /> 
    

    Plus, make sure that login.jsp is under /WEB-INF/jsp/login.jsp.

    EDIT after comment:

    Seem that you have no Spring Security config at all, so begin with this:

    <http auto-config='true' use-expressions="true">
      <intercept-url pattern="/login*" access="permitAll"/>
      <intercept-url pattern="/**" access="ROLE_USER" />
      <!-- use login-page='/login' assuming you've got 
           Spring MVC configured to redirect to login.jsp -->
      <form-login login-page='/login'/>
    </http>
    

    or, if you’re using Spring Security 3.1:

    <http pattern="/login" security="none" />
    <http auto-config='true'>
      <intercept-url pattern="/**" access="ROLE_USER" />
      <!-- use login-page='/login' assuming you've got 
           Spring MVC configured to redirect to login.jsp -->
      <form-login login-page='/login'/>
    </http>
    

    Create /WEB-INF/jsp/login.jsp file with example content:

    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <html>
    <head>
    <title>Login Page</title>
    </head>
    <body>
        <h3>Login</h3>
    
        <c:if test="${not empty error}">
            <div class="errorblock">
                Your login attempt was not successful, try again.<br /> Caused :
                ${sessionScope["SPRING_SECURITY_LAST_EXCEPTION"].message}
            </div>
        </c:if>
    
        <form name='f' action="<c:url value='j_spring_security_check' />"
            method='POST'>
    
            <table>
                <tr>
                    <td>User:</td>
                    <td><input type='text' name='j_username' value=''>
                    </td>
                </tr>
                <tr>
                    <td>Password:</td>
                    <td><input type='password' name='j_password' />
                    </td>
                </tr>
                <tr>
                    <td colspan='2'><input name="submit" type="submit"
                        value="submit" />
                    </td>
                </tr>
            </table>
    
        </form>
    </body>
    </html>
    

    And what’s more, please read about Spring Security, because these are really basics of this framework.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I have an autohotkey script which looks up a word in a bilingual dictionary
This could be a duplicate question, but I have no idea what search terms
I'm trying to select an H1 element which is the second-child in its group
I have a text area in my form which accepts all possible characters from
I am trying to loop through a bunch of documents I have to put
I have an array which has BIG numbers and small numbers in it. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.