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
Solved

URGENT!!--How to direct pages

Posted on 2003-12-11
11
230 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
  • 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
J2SE 5.0 metadata 1 61
Struts tiles for layout structure along with Angular JS. 4 172
getting param value 7 57
Why my table column Id is not passed to java object? 4 44
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

839 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