Solved

Redirect to Login page

Posted on 2014-02-27
2
366 Views
Last Modified: 2014-06-22
This sounds like old question, but I am stuck in resolving the issue for my case.

I am working on very big web application which has more than 20 modules. We kept the header and footer in a sperate module and the header.jsp and footer.jsp are including in all other modules through  jsp:include  tag.

We are maintaining our own user entitlement model and I want to add user Role validation. If the user has roles in our entitlement, then redirect to PageA if not redirect to Login page (PageB).

After adding this piece of code in header.jsp, it is not redirecting to different page which I required. On googgling, found that if we are including any pages using jsp:include the page redirection code in header.jsp will never works.

Can someone please suggest the alternative ideas?
0
Comment
Question by:Gangadhara Melukote
2 Comments
 
LVL 35

Assisted Solution

by:mccarl
mccarl earned 200 total points
ID: 39893483
Instead of using jsp:include are you able to use the below?
<%@include file="header.jsp" %>

Open in new window

0
 
LVL 20

Accepted Solution

by:
Amitkumar Panchal earned 300 total points
ID: 40057547
Agree with mccarl. You should use include directive if the included jsp contains a redirect statement.

The HttpServletResponse#sendRedirect() basically sets 302 as HTTP response status and target URL as HTTP Location header. It will be ignore if it is used in included jsp. Refer  http://docs.oracle.com/javaee/6/api/javax/servlet/RequestDispatcher.html#include%28javax.servlet.ServletRequest,%20javax.servlet.ServletResponse%29 for more info.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
mergeTwo  challenge 13 72
array6 challenfge 6 62
Java Message handling in Service Layer 3 37
Groovy:unable to resolve class error 2 30
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now