• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

JSP redirection and tabs..

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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/
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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()
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
reply
    Bookmark Topic Watch Topic
  • New Topic