Solved

URGENT!!--How to direct pages

Posted on 2003-12-11
11
232 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
Technology Partners: 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The conference as a whole was very interesting, although if one has to make a choice between this one and some others, you may want to check out the others.  This conference is aimed mainly at government agencies.  So it addresses the various compli…
This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

728 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