Role based login ..Need the concepts..

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









Related Tutorials/Questions & Answers:
Role based login ..Need the concepts.. - JavaMail
Role based login ..Need the concepts..  Role based login how can i do... or usergroup... but depending upon the role the functions should change... requriement.... Hoping for different concepts ... :-) With Regards, K.M.Anandh
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
Advertisements
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 J2ee project technical flow - Design concepts & design patterns
Need J2ee project technical flow   Hi friend,am newbie to web development.I need j2ee project technical project flow. For example Browser ---> Controller --> Servlet(validator) <
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
need
need  i need a jsp coding based project plz help me
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
After Clicking Image I need Popup Window - Design concepts & design patterns
After Clicking Image I need Popup Window  Hi Friends. when i click any image button , i need to display popup window in javascript.can u give code for this New Document EMPLOYEE DETAILS
login
login  i want to now how i can write code for form login incolude user and password in Jcreator 4.50   Hello Friend, Visit HereADS_TO_REPLACE_1 Thanks
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">
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
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
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
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
Role of Project Manager
Role of Project Manager  What are the role of a project manager in an Organisation
design role played by Struts.
design role played by Struts.  What is the design role played by Struts
role of JSP in MVC
role of JSP in MVC  What is the role of JSP in MVC Model?   JSP is mostly used to develop the user interface, It plays are role of View in the MVC Model
Maven dependency for org.opendaylight.bgpcep - concepts version 0.14.2 is released. Learn to use concepts version 0.14.2 in Maven based Java projects
of concepts released The developers of   org.opendaylight.bgpcep - concepts project have released the latest version of this library on 14 Jan 2021, the released version of  org.opendaylight.bgpcep - concepts library
Maven dependency for org.opendaylight.bgpcep - concepts version 0.15.0 is released. Learn to use concepts version 0.15.0 in Maven based Java projects
of concepts released The developers of   org.opendaylight.bgpcep - concepts project have released the latest version of this library on 26 Mar 2021, the released version of  org.opendaylight.bgpcep - concepts library
Maven dependency for org.opendaylight.bgpcep - concepts version 0.17.7 is released. Learn to use concepts version 0.17.7 in Maven based Java projects
of concepts released The developers of   org.opendaylight.bgpcep - concepts project have released the latest version of this library on 03 Nov 2022, the released version of  org.opendaylight.bgpcep - concepts library
Maven dependency for org.opendaylight.bgpcep - concepts version 0.17.2 is released. Learn to use concepts version 0.17.2 in Maven based Java projects
of concepts released The developers of   org.opendaylight.bgpcep - concepts project have released the latest version of this library on 25 Apr 2022, the released version of  org.opendaylight.bgpcep - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 2.0.1 is released. Learn to use concepts version 2.0.1 in Maven based Java projects
of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 18 Jan 2018, the released version of  org.opendaylight.yangtools - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 9.0.3 is released. Learn to use concepts version 9.0.3 in Maven based Java projects
of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 22 Nov 2022, the released version of  org.opendaylight.yangtools - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 10.0.1 is released. Learn to use concepts version 10.0.1 in Maven based Java projects
- concepts version 10.0.1 ) in their Java project if it is based on Maven and Gradle... of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 25 Nov
Maven dependency for org.opendaylight.yangtools - concepts version 8.0.9 is released. Learn to use concepts version 8.0.9 in Maven based Java projects
of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 26 Nov 2022, the released version of  org.opendaylight.yangtools - concepts library
Maven dependency for org.opendaylight.bgpcep - concepts version 0.18.4 is released. Learn to use concepts version 0.18.4 in Maven based Java projects
of concepts released The developers of   org.opendaylight.bgpcep - concepts project have released the latest version of this library on 05 Dec 2022, the released version of  org.opendaylight.bgpcep - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 10.0.2 is released. Learn to use concepts version 10.0.2 in Maven based Java projects
- concepts version 10.0.2 ) in their Java project if it is based on Maven and Gradle... of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 04 Dec
Maven dependency for org.opendaylight.yangtools - concepts version 8.0.3 is released. Learn to use concepts version 8.0.3 in Maven based Java projects
of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 14 Apr 2022, the released version of  org.opendaylight.yangtools - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 8.0.3 is released. Learn to use concepts version 8.0.3 in Maven based Java projects
of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 14 Apr 2022, the released version of  org.opendaylight.yangtools - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 0.8.0-Beryllium is released. Learn to use concepts version 0.8.0-Beryllium in Maven based Java projects
if it is based on Maven and Gradle. How to use  org.opendaylight.yangtools - concepts... 0.8.0-Beryllium of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library
Maven dependency for org.opendaylight.bgpcep - concepts version 0.16.14 is released. Learn to use concepts version 0.16.14 in Maven based Java projects
of concepts released The developers of   org.opendaylight.bgpcep - concepts project have released the latest version of this library on 15 Feb 2022, the released version of  org.opendaylight.bgpcep - concepts library
Maven dependency for org.opendaylight.bgpcep - concepts version 0.15.4 is released. Learn to use concepts version 0.15.4 in Maven based Java projects
of concepts released The developers of   org.opendaylight.bgpcep - concepts project have released the latest version of this library on 28 Jan 2022, the released version of  org.opendaylight.bgpcep - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 7.0.12 is released. Learn to use concepts version 7.0.12 in Maven based Java projects
- concepts version 7.0.12 ) in their Java project if it is based on Maven and Gradle... of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 19 Jan
Maven dependency for org.opendaylight.yangtools - concepts version 7.0.9 is released. Learn to use concepts version 7.0.9 in Maven based Java projects
of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 21 Oct 2021, the released version of  org.opendaylight.yangtools - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 7.0.6 is released. Learn to use concepts version 7.0.6 in Maven based Java projects
of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 23 Aug 2021, the released version of  org.opendaylight.yangtools - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 7.0.3 is released. Learn to use concepts version 7.0.3 in Maven based Java projects
of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 18 Jun 2021, the released version of  org.opendaylight.yangtools - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 7.0.0 is released. Learn to use concepts version 7.0.0 in Maven based Java projects
of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 26 Apr 2021, the released version of  org.opendaylight.yangtools - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 6.0.10 is released. Learn to use concepts version 6.0.10 in Maven based Java projects
- concepts version 6.0.10 ) in their Java project if it is based on Maven and Gradle... of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 08 Jan
Maven dependency for org.opendaylight.yangtools - concepts version 6.0.7 is released. Learn to use concepts version 6.0.7 in Maven based Java projects
of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 07 Jul 2021, the released version of  org.opendaylight.yangtools - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 6.0.4 is released. Learn to use concepts version 6.0.4 in Maven based Java projects
of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 23 Jan 2021, the released version of  org.opendaylight.yangtools - concepts library
Maven dependency for org.opendaylight.yangtools - concepts version 5.0.9 is released. Learn to use concepts version 5.0.9 in Maven based Java projects
of concepts released The developers of   org.opendaylight.yangtools - concepts project have released the latest version of this library on 01 Mar 2021, the released version of  org.opendaylight.yangtools - concepts library
Maven dependency for org.opendaylight.bgpcep - concepts version 0.16.12 is released. Learn to use concepts version 0.16.12 in Maven based Java projects
of concepts released The developers of   org.opendaylight.bgpcep - concepts project have released the latest version of this library on 23 Nov 2021, the released version of  org.opendaylight.bgpcep - concepts library

Ads