Hi every body,
I have question in the login.jsp
How I can write code for checking the admin and the normal user when he/she login to the website?
I want the code for checking the admin and the normal user in the same time if the person as admin then forword him to the admin page if the person as normal user then forword it to the user page.
please could you help me.....
After login any user first u check the user type role in action class i.e Maintain menus and their links .. like menuname, link,role type example HOME : admin_home.jsp : admin :null
HOME general_home.jsp : null :user
Another approach is you can add another column in your database table. I think you have Username and password in your table. You can another column in your table named "Access_Rigth". Where in you can fill it with eithe "ADMIN" or "NORMAL". Just retrieves this fields so can compare it later in your Servlet or script. Then point the Next Page to the AdminMain.jsp for Admin or Main.jsp for Normal User. I hope that helps
For me also the best solution is dealing with DB. User name is the key here, as Eku said.
I go with him, because you can choose the moderator or give some more specific rights to particular user. So creating another column is usefull which will differentiate who is normal user and who admin. Some times simple name other than "admin" or "administrator" is used for admin. ok
Originally Posted by Eku
normally i use user as 1,admin as 2.
so make 1 more column on db.
at the login.jsp
with a list box,ask user to choose either he is user or admin
this is a code segment of html.
Username: <input type="text" name="username" maxlength="45">
Password: <input type="password" name="pwd" maxlength="16"><select id="userType" name="category">
<option value="1" selected="selected">User</option>