• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP redirection and tabs..  RSS feed

 
James Dean
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the best way to do redirection using jsp's? I have to make a site where there are different user roles, ie. admin role vs a regular user. What is the best way to redirect the person after they login based on there role, they will have different gui's for each role?
Also, what is a good way to do tabbed navigation using jsp's? After the person logs in based on there role they will have a different gui, what is a good way to implement this to cut down on the html gui code?
Thanks for the help.
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello James,
what architectiure are you using for your web-application?
if you have not yet decided than i will recommend struts, It isbased on MVC and will solve your problem to great extend.
http://jakarta.apache.org/struts/
 
lali virdi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi use RequestDispatcher to go from one page to another if they are in the same web application
if they are different webapplication then sendRedirect()
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66158
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch "James Dean"!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Thanks!
bear
JSP Forum Bartender
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66158
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now as to your question:
If you are using a Model 2 pattern architecture for your app (and you should), then the login form should submit to a servlet that will authenticate the user and determine the user's role. (This info can be put into the session for future reference by subsequent requests).
Then, depending upon the determined role, you could forward to whichever JSP page is appropriate to display the UI for that role.
If the role UI's are not that different, I'd opt for creating custom tags that could be used on the page to conditionally include/exclude features not appropriate for the role (rather than having a lot of similar pages with only minor role-dependent differences).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!