• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in login  RSS feed

 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai to all
i am using jsp and servlet in my application.i have the option for login in all page like index.jsp,product.jsp.if user login in index.jsp .i have to redirect to index.jsp. if user login in product.jsp i have to redirect to product.jsp from servlet



thanks in advance
[ August 30, 2008: Message edited by: Bear Bibeault ]
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why dont you keep a single login page for all jsp pages, say login.jsp , so that whenever a user wants to login from any jsp page like products.jsp, supplier.jsp page , you can forward them to login.jsp !!
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i include login.jsp in all page.suppose if user login in product.jsp i have to redirect to product.jsp.if user login in supplier.jsp. i have to redirect to supplier.jsp
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Repeating the code on every page is a poor approach. The more common approach is to have a filter that checks if the user is logged in or not (usually by checking a token in the session). If not, the request is forwarded to the login page. The original URL is easy to record within hidden parameters or in the session. After login, you can send the user to the original URL.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!