Solved

URGENT!!--How to direct pages

Posted on 2003-12-11
11
229 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

When you’re making plans to join the modern business race, you should analyze various details that may affect your results. Nowadays, millions of businesses are trying to grow into established and appreciated professional enterprises.
An article on effective troubleshooting
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

776 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