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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:47:18+00:00 2026-06-11T05:47:18+00:00

After checking the condition if the condition fails then using request dispatcher iam redirecting

  • 0

After checking the condition if the condition fails then using request dispatcher iam redirecting it to some other page.It is redirecting to that page but the css is not applying to that page.Why is it so?

public class RolePrivilegeFilter implements Filter {
List<String> privilege = null;
private static final String notAuthorizedPath = "/home/notAuthorized.jsf";
@Override
public void destroy() {
log.info("filter finish");
}

@Override
public void doFilter(ServletRequest sRequest, ServletResponse sResponse, FilterChain filterChain) throws IOException, ServletException {
String smUser = null;
 try {
    HttpServletRequest request = (HttpServletRequest) sRequest;
    HttpServletResponse response = (HttpServletResponse) sResponse;
    HttpSession session = null;
    try {
        request = (HttpServletRequest) sRequest;
        smUser =  request.getHeader(EnvironmentBean.SESSION_ATTR_SM_USER);
        } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
        }
    if (rolePrivilege == null || rolePrivilege.isEmpty()) {
    rolePrivilege = new RolePrivilegeBuilderImpl().rolePrivilege("Smtest2");
    privilege filter bean is\t"+rolePrivilege);
    log.debug("After rolePrivilege: " + rolePrivilege);
    if (rolePrivilege != null && rolePrivilege.size() > 0 ) {
    if (session == null) {
        session = request.getSession(true);
    }
    session.setAttribute("privilege", rolePrivilege);

    } else {
             //This is the page iam  redirecting to. 
    System.out.println("role privilege not authorized page");
    RequestDispatcher rd = request.getRequestDispatcher(notAuthorizedPath);
                    rd.forward(request, response);
                    return;
           }
    } catch (Exception e) {
        e.printStackTrace();
        log.debug("Error in setting session attribute: " + e.getMessage());
    }
    log.debug("doFilter() finish");
    filterChain.doFilter(sRequest, sResponse);
}

@Override
public void init(FilterConfig arg0) throws ServletException {
    log.info("filter start");

}
}

The problem is iam redirecting to that page but the css to that page is not being applied like background image not getting displayed.Why is it so?

  • 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-11T05:47:19+00:00Added an answer on June 11, 2026 at 5:47 am

    Apparently the filter’s URL pattern did also match the browser’s request for that CSS file and thus it has also been blocked by the filter. Apparently you’ve mapped the filter on a too broad URL pattern like as /* or something.

    You need to ensure that the filter bypasses all those CSS file requests. If there’s no way to change the filter’s URL pattern accordingly so that it bypasses CSS file requests, e.g. changing /* to /app/* so that it only runs on requests in /app folder where all restricted resources are, then you need to rewrite the filter’s code to add an extra check on the request URI.

    Something like this:

    if (request.getRequestURI().endsWith(".css")) {
        chain.doFilter(request, response);
        return;
    }
    

    This will let all *.css requests be passed instead of being blocked.

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

Sidebar

Related Questions

How to remove using jquery html table row after checking checkbox that in this
I want to display error message or alert message after checking the condition. here
After checking out code for the first time from a repository into Eclipse using
After checking 20+ answers I'm sure there is no way to trace (using JS
i created a login page in php and used session in it... after checking
I have a loop that is doing some error checking in my PHP code.
I just went through some MVC tutorials after checking this site out for a
I want to insert different url's dynamically after checking a condition Here's the pseudocode
creating a basic log in page - it was working but then we changed
After checking out a branch in a repository git always prints a list of

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.