Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

sendRedirect issue  RSS feed

 
Abhijeet Gholkar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends
Iam coding an administration module in jsp. I take data in login.html , check if user is valid from database in logger.jsp and then sendRedirect to index.jsp. This consistently works with netscape but in ie6 it shows two pages in the same browser window with the http header contents between them. Iam not get a break through. Please help.
Iam using tomcat3.2.1 on linux
thanks
[ August 17, 2002: Message edited by: Gholkar Raja ]
 
vishal avad
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raja
I m not experienced with sendRedirect concept. I would like to suggest u to use <jsp:forward page:"<pagename>" />.This ll work fine 4 both
HIH
Regards
Vishal
 
Jerome Lumpkin
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gholkar,
With respect to response.sendRedirect("new_url"), what is actually happening is that it is making a round trip back to the client window (IE or Netscape) and simulating the user/client actually typing in another URL and hitting ENTER.
Normally, you can't see it unless you're on a slow speed dial-up connection or the internet is hiccuping. The <jsp:forward> that was suggested to you by the previous response is in actuality a "RequestDispatcher forward" command which does not make a round trip to the client. The redirect with "RequestDispatcher forward" occurs on the server side. However, it is not "back" button friendly since if the user hits "back" on his/her browser, they are returned to the previous URL in their history, which is not the last page.
Jerome
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to try following the MVC architecture (see Jakarta Struts). Instead of putting your login logic in a JSP page, put it in a JavaBean and access that bean using a servlet (or Struts action bean). If the JavaBean successfully logs in the user, forward the request to your index.jsp page. If not, forward back to your login form.
Otherwise, you might want to try using the built-in login functionality in the servlet specificiation by adding security-constraint, login-config, and security-role elements to your web.xml file. Hope this helps.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!