File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes different role stored in mySQL can access different jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "different role stored in mySQL can access different jsp " Watch "different role stored in mySQL can access different jsp " New topic
Author

different role stored in mySQL can access different jsp

Melvin Reynold
Greenhorn

Joined: Jun 12, 2009
Posts: 15
First of all, i dont speak or write in english very well. I have a database named sales. And in sales, i have a table named User. In User, i have values named serial no., username, password and role. Role is given by choosing an option in a drop down list either Admin or User from a java server page. And it is stored in User table. What i want is if a username with an admin role log in, that username will enter a different jsp than the username with a User role. for example once user ABC with an Admin role log in, he will enter A.jsp but if user ABCD with User role log in, he will enter B.jsp. Thanks.


This is my controller and im using doGet




This is where i create the method checkUsername



This is my javascript



Drew Vent
Greenhorn

Joined: Jul 01, 2009
Posts: 1
I'd would like to know this too please. Thanks!
Himanshu Kansal
Ranch Hand

Joined: Jul 05, 2009
Posts: 257
What are you returning "int iDataCount" for from "public int checkUsername(HttpServletRequest, HttpServletResponse)" ?

In my opinion, you should be returning a String or a final int. Check that returned value in the doGet method and set the value of strTargetPage accordingly.


Experience and talent are independent of age
Charbel Keyrouz
Ranch Hand

Joined: Jun 10, 2005
Posts: 46
The best solution is to implement JAAS where you can assign for each page a security role and if a user is accessing a page outside his security he will be redirected to the login page automatically.
The configuration of the security roles is done in the web.xml.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: different role stored in mySQL can access different jsp
 
Similar Threads
alert first option in a drop down list
Calling JNDI from JSP
Browser Path Not Refreshing
Vector from bean to servlet?
java .lang .Number Format Error