Solved

URGENT!!--How to direct pages

Posted on 2003-12-11
11
231 Views
Last Modified: 2010-04-01
Hi,

I have an application that is been used by 3 users:

One the volunteers-page1,page2

one the organization-page1,page2 and etc

one user the administrator-page1,page2....

How when the user logs-in,

if volunteer direct into their pages.

if organization ,direct into their pages..

if administrator,direct into their pages..




0
Comment
Question by:Jasbir21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
11 Comments
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 100 total points
ID: 9920092
just as you have written it in your question......

<%
String type = request.getParameter("userType")  //Here I am assuming that you will get the type from request.
if(type.equals("user"))
{%>
<jsp:forward page="userpage.jsp"/>
<%}
if(type.equals("admin"))
{%>
<jsp:forward page="adminpage.jsp"/>
<%}
if(type.equals("volnteer"))
{%>
<jsp:forward page="volnteerpage.jsp"/>
<%}

that is about it...
All I have done is wrote your english in jsp...:-)
0
 

Author Comment

by:Jasbir21
ID: 9920185
hi,
   I think i understand, i never get usertype,but now i will thanks.
  what if i got many pages, i mean:

volunteers-page1,page2

one the organization-page1,page2 and etc

one user the administrator-page1,page2
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 9920302
well.... you will start from one page and then it will navigate from one page to another.........
you can not show all of the pages one by one right???
and I assume that these pages are separate pages to each other.... so they should be able to handle their own navigation in my opinion.....
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:jimmack
ID: 9920462
If you're adding a usertype as you seem to indicate, you can store that in a session variable, rather than having to keep retrieving it from the client (obviously, you'll need to identify the type when they first log in ;-))

Have you had a look at Realms yet?  If you use Realms, you could use:

if (request.isUserInRole("admin"))
{
}
else if (request.isUserInRole("typeA"))
{
}

etc.

Where the role is declared in the Realm data.  Ideally, you'd want to do this with a database, but you should be able to try the idea out quite quickly if you create a "Memory Realm".  Have a look towards the end of this link: http://jakarta.apache.org/tomcat/tomcat-4.0-doc/realm-howto.html

If you don't want to use realms, just mention this in your next post and I'll stop nagging on about it ;-)
0
 

Author Comment

by:Jasbir21
ID: 9920617
Jimmack,
  I added the usertype, but my problem i found out that i did something that i got an error. I mean, when i click, it does not go to other page. What wrong could i have done....


pls help ,
thanks
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9920699
Is there any error output available?

It might be a good idea to display the usertype somewhere (for debugging purposes), so that you know you are comparing it to the correct value.

(eg. if you just did a cut-and-paste with Kuldeepchaturvedi's code, he had a typo for the spelling of volunteer).
0
 

Author Comment

by:Jasbir21
ID: 9924917
hi,
 i guess, my problem is the way i navigated the pages, it is not so ok.
So, i thought, if i need to change the navigation of pages a lot, i need to redo a lot of the project...
...so, i thought, i use realm, i think i did something that the realm usertype is not being properly redirected.

Pls help,thanks
0
 

Author Comment

by:Jasbir21
ID: 9924946
or, do you think , it is better i change naviagation of pages..

thanks
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9924962
If you identify the type of user when they have logged in, you can avoid having to check all the time by keeping separate pages for the different types of user (eg. one set of JSPs for admins and another set for normal users).

When your JSP is generating the first response after login, you could modify the links on the page appropriately.

This way, you would only need to do role checking in the pages that they share.
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 9926018
well that will need him changing all the code that he has already written...
I would rather suggest to getting straight the navigation of the pages
0
 

Author Comment

by:Jasbir21
ID: 9932185
ok, i think i understand,i would work on it now.

I think my main problem is the way i naviagate the pages, is very bad.

Thanks you
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was initially published on Monitis Blog, you can read it here . When it comes to deciding which approach to website performance monitoring is best for your business, unfortunately, like so many options in life . . . it depends. In t…
In order to fulfill our mission of inspiring learning in the technology community, Experts Exchange is launching a Course of the Month program. Premium and Team Account members will have access to one course per month as a part of their membership, …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question