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 7056987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:55:57+00:00 2026-05-28T03:55:57+00:00

I’m trying implement a custom login page to use in my JSF 2.0 application.

  • 0

I’m trying implement a custom login page to use in my JSF 2.0 application. I’m using spring security 3.0.5 and after user logins, the page isn’t redirect correctly. Instead of going to the page requested (localhost:8080/erp-web), it is going to this:

http://localhost:8080/erp-web/javax.faces.resource/forms/forms.js.xhtml?ln=primefaces&v=2.2.1

This is my jsf page:

<h:form prependId="false">
    <h:panelGroup layout="block" class="hrgi-dialog-content hrgi-div-form clearfix">
        <p:focus/>            
        <h:outputLabel for="j_username"/>
        <p:inputText id="j_username" value="#{loginBean.usuario}" required="true"/>
        <h:outputLabel for="j_password"/>
        <h:inputSecret id="j_password" value="#{loginBean.senha}" required="true"/>
        <h:commandButton id="submit" type="submit" value="OK" action="#{loginBean.submit}"/>
    </h:panelGroup>
</h:form>

This is the bean used:

public class LoginBean {

    private String usuario;
    private String senha;

    public String submit() throws IOException, ServletException {
        ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
        RequestDispatcher dispatcher = ((ServletRequest) context.getRequest()).getRequestDispatcher("/j_spring_security_check");
        dispatcher.forward((ServletRequest) context.getRequest(), (ServletResponse) context.getResponse());
        FacesContext.getCurrentInstance().responseComplete();
        return null;
    }

/*getters and setters here*/

}

Finally this is my spring security config file:

<http auto-config="true">
    <intercept-url pattern="/login.xhtml*" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
    <intercept-url pattern="/**" access="ROLE_CADASTRADOR,ROLE_ADMINISTRADOR,ROLE_VENDEDOR,ROLE_BANCO"/>
    <form-login login-page="/login.xhtml"/>
    <session-management>
        <concurrency-control max-sessions="1" error-if-maximum-exceeded="true"/>
    </session-management>
</http>

<authentication-manager alias="authenticationManager">
    <authentication-provider ref="daoAuthenticationProvider"/>
</authentication-manager>

<bean:bean id="daoAuthenticationProvider"
           class="org.springframework.security.authentication.dao.DaoAuthenticationProvider"
           scope="singleton">
    <bean:property name="userDetailsService" ref="detalhadorDeUsuarios"/>
    <bean:property name="passwordEncoder" ref="passwordEncoder"/>
</bean:bean>

<bean:bean id="detalhadorDeUsuarios" class="com.hrgi.web.seguranca.DetalhadorDeUsuarios"
           scope="singleton">
    <bean:property name="recuperador" ref="funcionarioDao"/>
</bean:bean>

<bean:bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"
           scope="singleton">
    <bean:constructor-arg name="strength" value="256"/>
</bean:bean>

<bean:bean id="loginBean" class="com.hrgi.web.seguranca.LoginBean" scope="request"/>


<bean:bean id="loggerListener"
      class="org.springframework.security.authentication.event.LoggerListener" />

Here is what I receive as response:
after login app is redirecting to wrong place

  • 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-05-28T03:55:58+00:00Added an answer on May 28, 2026 at 3:55 am

    You should add js/css resource to unrestricted, something like

    <intercept-url pattern="/**/*.css*" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
    <intercept-url pattern="/**/*.js*" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
    

    The problem is spring security intercepts your request for js file required by login page and enforces authentication. When it’s done it redirects to the most recent restricted URL, javascript in your case.

    • 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
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.