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

  • Home
  • SEARCH
  • 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 443985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:13:31+00:00 2026-05-12T21:13:31+00:00

I am fairly new to Servlet Filters and have basically joined a project using

  • 0

I am fairly new to Servlet Filters and have basically joined a project using them and added an additional filter to the web.xml file (deployed on Tomcat 5.5).

I am 95% sure that at some point it was working correctly but now when debugging if I put breakpoints at the top of the JSP page I am trying to view (login.jsp), it’s template page (page.jsp) and within both of the configured filter’s doFilter() method; it runs through the whole of the login.jsp page (top to bottom), then page.jsp and the starts processing the filters.

I need it to run the filters first, since one of them determines the language the page should be displayed in (checking cookies, db settings and browser settings) which should then apply to the login.jsp.

Has anyone got any suggestions as to what might be going wrong?

There is a lot of code I could be posting but am not convinced that would be of any use since it’s all working just in the wrong order.

Snippets from the web.xml:

<web-app>
...
<filter>
        <filter-name>SetSecurityContextFilter</filter-name>
        <filter-class>
            com.section2.SecurityContextServletFilter
        </filter-class>
    </filter>

<filter>
    <filter-name>SetLocaleFilter</filter-name>
    <filter-class>
        com.section2.locale.LocaleServletFilter
    </filter-class>
</filter>

<filter>
    <filter-name>trinidad</filter-name>
    <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
</filter>

<filter>
    <filter-name>ActiveUserFilter</filter-name>
    <filter-class>com.section2.ActiveUserFilter</filter-class>
</filter>

    <filter-mapping>
        <filter-name>trinidad</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>

    <filter-mapping>
        <filter-name>SetSecurityContextFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>SetLocaleFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>ActiveUserFilter</filter-name>
        <url-pattern>/pages/section2/user/*</url-pattern>
    </filter-mapping>

...
</web-app>

Thanks in advance.

  • 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-12T21:13:32+00:00Added an answer on May 12, 2026 at 9:13 pm

    Thanks for your replies – I have now understood the issue fully…it only happens for the login.jsp page, none of the other pages. And in my case, the login .jsp page is a special case because it is usually viewed as a result of a redirect.

    In the web.xml:

    <login-config>
            <auth-method>FORM</auth-method>
            <form-login-config>
                <form-login-page>/login.jsp</form-login-page>
                <form-error-page>/login.jsp?error=true</form-error-page>
            </form-login-config>
        </login-config>
    

    And I presume because of this, the filters are not hit in the usual order! Added a call from the login page to do what the filter does and all is well.

    Thanks again.

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

Sidebar

Related Questions

I'm fairly new to writing web services. I'm working on a SOAP service using
Fairly new to wpf, using the galasoft mvvm templates. I have two relaycommands that
I am new to fairly new to AS3 and I have found myself needing
I am fairly new to php and mysql but I have created a small
Fairly new to MVC3 and I am doing a simple project for testing purposes.
Fairly new to socket programming, but I've been assigned with a whopper of project.
Being fairly new to C++ I have a question bascially concerning the g++ compiler
Am fairly new to using MySQL and a total novice at Perl but am
im fairly new to databases in vb.net and i have just learned how to
I'm fairly new at JSP and I need some help. I have an index.jsp

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.