• Post Reply Bookmark Topic Watch Topic
  • New Topic

how and when is redirect used  RSS feed

 
Sidharath Sharma
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,
Need your help.
I have several JSP's one of which is a login JSP. Every JSP has link to the login JSP.
Once I login successfully , how shloud i redirect to the JSP from which I had opened
my login screen.
I had used response.sendRedirect("name.jsp");
but this is not working.
 
chanoch wiggers
Author
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I take it that each page has a
if(logged in) {
//show page
} else {
%>"<a href="login.jsp">please log in</a>");<%
}
%>
and then login has both the HTML and the login code sort of like this:
check if login information provided;
if(logged in successfully) {
//forward to page;
else {
%>
please enter your login details
username:
password:
<%
}
%>
if that is the case, then you could just use the
forward tag to redirect them without them even knowing like this:
if(logged in successfully) {
<jsp:forward page="nextpage.jsp" />
}
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!