Role based login ..Need the concepts..

Ads
 

Role based login ..Need the concepts..

View Answers

August 26, 2008 at 6:09 PM

Hi friend,


This code help to solve your problem :

Some points remember
"login.jsp"

1)Code have two file "login.jsp" and "welcome.jsp".
2)In "login.jsp" if select "Admin" it display "Delete" button with success message" and if select "Employee" it not display "Delete".


<html>
<head>
</head>
<body>
<form name="loginform" method="post" action="welcome.jsp">
<table>
<tr>

<tr>
<td>Login Name</td>
<td>
<select name="type">
<option value="Admin">Admin</option>
<option value="Employee">Employee</option>
</select>
</td>
</tr>
<tr>
<td>Login Name</td>
<td><input type="text" name="userName" value=""></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" value=""></td>
</tr>

<tr>
<td></td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>


</body>
</html>

"welcome.jsp"

<html>
<head>
</head>
<body>
<table>

<%

if((request.getParameter("type")!=null) && request.getParameter("userName")!="" && (request.getParameter("userName")!=null) && (request.getParameter("password")!=null))
{
if(request.getParameter("type").equals("Admin") )
{
%>
<tr>
<td><b>Welcome <%=request.getParameter("userName")%></b></td></tr>
<tr><td><input type="button" value="Delete"></td></tr>

<%
}
if(request.getParameter("type").equals("Employee"))
{
%>
<tr>
<td><b>Welcome <%=request.getParameter("userName")%></b></td></tr>
<%
}

}
else
{
response.sendRedirect("login.jsp");
}
%>
</body>
</html>

If you have any more problem then give in details.

Read for more information :

http://www.roseindia.net/

Thanks




September 3, 2008 at 4:00 PM

Thank You .. i too have done the same way only... but the Login Type as Hidden value and i am checking tht and then redirecting them ... fine..

With Regards,
K.M.Anandh

Ads









Related Tutorials/Questions & Answers:
User LogIn According to Role
User LogIn According to Role  User login According to role but output will be always displayed in a single page.. but content will change according role
Need to get the Data based on Date
Need to get the Data based on Date  Hie , I am having a criteria where i need to get the data based on date . I have written the query as "from Balance as b where b.date like ?" But the date field in DB is in datetime2 format
Advertisements
Spring alternative to Form Based Login
Spring alternative to Form Based Login  print("code sample");how can we make a server to listen to login event i.e. Authenticate a user not using jsp. Using a login form we can use the jspringsecurity_check. How can we do
need a login applet in java
need a login applet in java  i'm java beginner. Can some java master teach me how to write a login applet? combine with my coding import javax.swing.*; import java.applet.*; import java.awt.*; import java.util.*; import
need a login applet in java
need a login applet in java  i'm java beginner. Can some java master teach me how to write a login applet? combine with my coding import javax.swing.*; import java.applet.*; import java.awt.*; import java.util.*; import
need code for login in asp.net with c#
need code for login in asp.net with c#  hai iam trying to develop a project in asp.net with c#,so i need a code for login page using which admin and other users can log in.plz help me, thanks in advance
Need query for rollup based on month and category
Need query for rollup based on month and category   Hi, Here is my question.. I have a table as below. trans_date,cateory,amount 1-1-11,1,10 2-1-11,2,20 3-2-11,3,15 23-2-11,4,12 13-5-11,4,19 Need a query to get result like
Need help to create Struts 2 MySQL based HRMS application.
Need help to create Struts 2 MySQL based HRMS application.   Hi Sir, I am doing my project based on Human Resource Management system using struts 2... login and profile management. Please reply me asap. Thanks in advance.   
How to make Struts Hibernate and Spring Based Login/Registration Application?
How to make Struts Hibernate and Spring Based Login/Registration Application... in Hibernate. Is there any code for to make Struts Hibernate and Spring Based Login... to make application. Check the tutorial Developing Struts Hibernate and Spring Based
need
need  i need a jsp coding based project plz help me
login
login  How to create login page in jsp
login
login  How to create login page in jsp
login
login  login page display an error showing failure to login even when the correct information is entered
Struts 2 Login Application
to make the login system for Struts2 based applications. Login application...Examples of writing and testing Login Applications in Struts 2 framework These days almost all the web applications and even websites need such system
Hibernate concepts
Hibernate concepts  hibernate concepts Entity System,Entity Named Resolver,Auxiliary database objects,ternary associations and interceptors are used in real -time programming
login
login  how to login admin and user with the same fields(name & password) in single login page while the table for admin and user is seprate in database(mysql) please provide me solution
Top 10 Web Developments Concepts Designers Should Know
Top 10 Web Developments Concepts Designers Should Know When it comes to web... concepts is so challenging. For some years with the proliferation of mobile computing... increasingly, web development and design concepts also went through a great array
login
java.awt.event.*; class Login { JButton SUBMIT; JLabel label1,label2; final JTextField text1,text2; Login() { final JFrame f=new JFrame("Login Form...(); ResultSet rs=st.executeQuery("select * from login where username='"+value1
login
login  how to create login page in jsp   Here is a jsp code that creates the login page and check whether the user is valid or not. 1...;tr><td></td><td><input type="submit" value="Login">
login
login  i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
login
login  i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
login
login  i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
login
login  i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
OOPs concepts in Java
Object-Oriented Programming (OOPs) concepts in Java helps in creating programs that are based on real world. OOPs is very flexible and compatible and hence... application that are developed on the OOPs concepts at first analyze the program
login
login  hello i need some help please help how can identify admin from user when logging in? please make some answer and some explanation...   Please visit the following link; http://www.roseindia.net/jsp
ModuleNotFoundError: No module named 'concepts'
ModuleNotFoundError: No module named 'concepts'  Hi, My Python... 'concepts' How to remove the ModuleNotFoundError: No module named 'concepts... to install padas library. You can install concepts python with following
ModuleNotFoundError: No module named 'concepts'
ModuleNotFoundError: No module named 'concepts'  Hi, My Python... 'concepts' How to remove the ModuleNotFoundError: No module named 'concepts... to install padas library. You can install concepts python with following
Role of Project Manager
Role of Project Manager  What are the role of a project manager in an Organisation
need live chat project
need live chat project  Hi, I need register,login later start live chat project   hi
java based question
java based question  if there is a site and after user login on the right top there is a button of logout and i want to display firstname and lastname of the user after login then in what class i have to do changes?? and what
java concepts - Java Beginners
java concepts   i need theory for lisp-like list in java to perform basic operations such as car, cdr ,cons

Ads