Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaMail Role based login ..Need the concepts..
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Anandh
Role based login ..Need the concepts..
2 Answer(s)      6 years and 4 months ago
Posted in : JavaMail



Advertisement
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
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 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
PHP Based Chatserver - Design concepts & design patterns
PHP Based Chatserver  Hey i want to create a Chat server like this one : www.scn-chat.com could someone plz tell me were can i get a chatserver
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.   
Need to implement Paging and field based sorting in JSP Servlet - JSP-Servlet
Need to implement Paging and field based sorting in JSP Servlet  Hi, Can some one please guide me how we can implement the paging and field based... Roll No. Class etc etc As per my requirement i need to first
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) <
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
login
login  How to create login page in jsp
login
login  How to create login page in jsp
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
login
login  login page display an error showing failure to login even when the correct information is entered
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
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 Here 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">
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
need  i need a jsp coding based project plz help me
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
DIFFERENT PAGES FOR DIFFERENT USERS ACCORDING TO THEIR ROLE
DIFFERENT PAGES FOR DIFFERENT USERS ACCORDING TO THEIR ROLE  I HAVE A PROBLEM IN PHP CODING PLS HELP ME PROBLEM IS THAT I WANT DIFFERENT PAGES TO VIEW FOR DIFFERENT USERS WHEN THEY LOGIN ACCORDING TO THEIR ROLE IN DATABASE
Struts 2 Login Application
Struts 2 Login Application       Developing Struts 2 Login Application In this section we are going to develop login application based on Struts 2 Framework. Our current login application
Advertisements
 

 

 

DMCA.com