Home Answers Viewqa Java-Beginners Jsp code to enable and disable certain links using jsp code

 
 


Deb
Jsp code to enable and disable certain links using jsp code
4 Answer(s)      3 years and a month ago
Posted in : Java Beginners

Hi Everyone,

I have a doubt in JSP,I have created a web application which has priviledges of a superuser and guest..now if a superuser logs in the page gets redirected to home page where all the links under a menu should be visible and enabled whereas when a guest logs in he should be redirected to the same home page but with only a certain links only visible and enabled. now my doubt is how can i write the code to disable these links..
Can anyone help me?? its really really urgent.................!!
Please :)

Thanks in advance
Debo
View Answers

May 28, 2010 at 12:19 PM


Hi Friend,

Try the following code:

1)login.html:

<html>
<head>
</head>
<body>
<form name="form" method="post" action="http://localhost:8080/examples/jsp/mod.jsp">;
<br><br>
<table align="center"><tr><td><h2>Login Authentication</h2></td></tr></table>
<table width="300px" align="center" style="border:1px solid #000000;background-color:#efefef;">
<tr><td colspan=2></td></tr>
<tr><td colspan=2>&nbsp;</td></tr>
<tr>
<td><b>Login Name</b></td>
<td><input type="text" name="username" value=""></td>
</tr>
<tr>
<td><b>Password</b></td>
<td><input type="password" name="password" value=""></td>
</tr>

<tr>
<td></td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
<tr>
<td></td>
<td align="right"><a href="register.html">New User?</a></td>
</tr>
</table>
</table>
</form>

</body>
</html>

2)mod.jsp:
<%@page import="java.sql.*"%>
<html>
<body>
<%
String user=request.getParameter("username");
String pass=request.getParameter("password");
%>
<%
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root";, "root");
Statement st=connection.createStatement();
ResultSet rs=st.executeQuery("Select * from user where username='"+user+"' and password='"+pass+"'");
String username="";
String pwd="",type="";
while(rs.next()){
username=rs.getString("username");
pwd=rs.getString("password") ;
type=rs.getString("type") ;
}
if(user.equals(username)&&pass.equals(pwd)){
response.sendRedirect("home.jsp?user="+user+"&&type="+type);

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

3)home.jsp:

<%
String name=request.getParameter("user");
String type=request.getParameter("type");
System.out.println(type);
%>
Welcome <%=name%>,<br><br>
<%
if(type.equals("superuser")){
%>
<a id="one" href="edit.jsp">Edit Profile</a><br>
<a id="two" href="view.jsp">View Profile</a><br>
<a id="three" href="delete.jsp">Delete Profile</a>
<%
}
else{
%>
<a id="two" href="view.jsp">View Profile</a><br>
<%
}
%>

Thanks

May 28, 2010 at 12:56 PM


Thank u so much....I will try to use this code to get some help... :)

May 28, 2010 at 12:57 PM


Thank u so much....I will try to use this code to get some help... :)

May 28, 2010 at 1:22 PM


Hi,

As per the code u posted i tried to apply it...but i have used sessions in my code.For the particular session used i have to enable/disable a link.I need a code to do that.

Thanks in advance :)









Related Pages:
Jsp code to enable and disable certain links using jsp code - Java Beginners
Jsp code to enable and disable certain links using jsp code  Hi... write the code to disable these links.. Can anyone help me?? its really really... have to enable/disable a link.I need a code to do that. Thanks in advance
how to enable and disable a input type in jsp - JSP-Servlet
how to enable and disable a input type in jsp  how to disable the input type and enable based on some input in the input type   Hi Friend, Try the following code: function function1(){ var n
JSP Tutorials Resource - Useful Jsp Tutorials Links and Resources
(JSP) using Dreamweaver MX 2004 and a MySQL database.    ... servlet and JSP code: Learning how to develop Java servlets and JavaServer... using JAVA servlets, JAVA Server Pages (JSP and JASPER page compiler), Jakarta
jsp code
jsp code  hi i am Ruchi can anybody plz tell me the jsp code for searching fromwhole database. I am using Oracle10g Database.   Please visit the following links: http://www.roseindia.net/jsp/user-search.shtml http
Disable of Combo - JSP-Servlet
details with source code and specify the technology you have used like Jsp/Servlet...Disable of Combo  Hi! Thanks for your fast reply. In my project i.... That means every user can give grade only at once... so i would like to disable
jsp code plz
;Please visit the following links: http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/jsp/popup-window-using-ajax-in-jsp.shtml The above links...jsp code plz  write jsp code which takes student roll number as input
How to generate pdf file on click of the links using jsp..
How to generate pdf file on click of the links using jsp..  How to generate the pdf file using jsp file. Generate table in pdf by using jsp.  ... the given code. <%@page import="java.io.*"%> <%@page import="java.util.*"%>
Jsp code for disabling record.
Jsp code for disabling record.  I want a Jsp and servlet code... to disable the record.System marks the record as disabled.The record... in Advance from my side. I am using MyEclipse and DB2
JSP CODE
JSP CODE  what is the code for downloading images from database using JSP?   Please visit the following link: http://www.roseindia.net/jsp/downloadimage.shtml
Enable and Disable Tab in Java
Enable and Disable Tab in Java   ... number. To enable or disable any tab you can use the setEnabledAt(int index... and APIs that you can use in your program to enable or disable the tabs. addTab
jsp code
jsp code  i want health management system project code using jsp.its urgent
how to make enable/disable textbox in while(rs.next)
how to make enable/disable textbox in while(rs.next)  Hi, I'm trying to enable/disable the textbox in the while loop. It works but when i want to update my data, the data are not updated correctly. When i remove the enable
how to make enable/disable textbox in while(rs.next)
how to make enable/disable textbox in while(rs.next)  Hi, I'm trying to enable/disable the textbox in the while loop. It works but when i want to update my data, the data are not updated correctly. When i remove the enable
JSP code
JSP code  I get an error when i execute the following code : <... = con.createStatement(); st.executeQuery(query); %> <jsp:forward page="address.jsp"></jsp:forward> HTTP Status 500 - type Exception report message
JSP Code - JSP-Servlet
, Please visit the following links: http://www.roseindia.net/jsp/data-grid.shtml http://www.roseindia.net/jsp/paging.shtml Thanks...JSP Code  Hi, Do we have a datagrid equivalent concept in JSP
jsp code - JSP-Servlet
jsp code  I need code for bar charts using jsp. I searched some code but they are contain some of their own packages. Please give me asimple code... friend, Code to solve the problem : Thanks
jsp code - JSP-Servlet
jsp code  how to count no of clicks made on a link and save it on database( using jsp)  Hi Friend, Try the following code: 1)click.jsp var numberOfClicks = 0; function hello(){ numberOfClicks
jsp code - JSP-Servlet
jsp code  Hello Everybody, can anyone help me to findout the modules as i am developing a whiteboard application using jsp? this application is my dream application. Thank you
JSP code - JSP-Servlet
me how to link these pages with each other using JSP..and how to write the code using JSP.. requriment for Newuser: 1>fname,lastname 2>Loginname...JSP code  hello,i working in project with JSP technology,i have one
jsp code - JSP-Servlet
jsp code  how to write a code in jsp with out using servelts finding sum and avg of 40 numbers  Hi Friend, Try the following code: Thanks  Hi Friend, Do one change in the provided code.As we
java beans code in jsp - WebSevices
java beans code in jsp  can you tell me how to use java beans in jsp... connecting jsp page to mysql database. please send me the code for login page, myaccount..., Please visit the following links: http://www.roseindia.net/jsp
jsp code - JSP-Servlet
to generate second drop down list by using jsp? pls ?   Hi Friend...jsp code  hi my requirement is generate dynamic drop down lists... the second drop down list is displayed from mysql data base table by using select
jsp code - JSP-Servlet
jsp code  how to get multi-chat client using jsp? i will be very glad if i'd get an idea from you people. thank you .  Hi Friend... (which runs on client side). This application is using for chatting in LAN
jsp code - JSP-Servlet
jsp code  i want to add below code data in mysql database using jsp... using below code we got data in text box i want to add multiple data in database... Add/Remove dynamic rows in HTML table
disable the form - JSP-Servlet
that particular button disable by using document.formname.buttonname.disable = true...disable the form  Hi All, I'm developing a small application. I wrote jsp page in that 8 forms are there.all forms are same but the input values
JSP Code - JSP-Servlet
JSP Code  Hi, I have a problem in limiting the number of row... to display only 10 records per pages in jsp, then how can i achieve this concept... Rai.  Hi Friend, Try the following code: Pagination
JSP code - JSP-Servlet
JSP code  Hi! Can somebody provide a line by line explanation of the following code. The code is used to upload and download an image. <... have successfully upload the file by the name of: Download /*Code
In pagination how to hilight the links - JSP-Servlet
In pagination how to hilight the links  Dear Sir, In pagination how to highlight the links or how to change the color of that link when i clickon that particular link....Please help me sir.. Some of the code which i
Jsp Code Problem - JSP-Servlet
Jsp Code Problem  I use DocType in my Jsp Page. The Links are not functioned after Applying the DocType. Could you tell me any way to activate the link. Thank You.   Hi Friend, Please send your code. Thanks
database connectivity using jsp code
database connectivity using jsp code  i have two tables employee...),'bbbb','bbbb'); so this syntax is possible to use in jsp code based on employee id ename and designation are displayed how it is possible in jsp employee
jsp code
jsp code  what are the jsp code for view page in online journal
In pagination how to hilight the links - JSP-Servlet
Harini Veerapur.   Hi Friend, Use the following code: click
jsp excel code - JSP-Servlet
jsp excel code  hi how to store html form data into excel sheet by using jsp? and repeat this process continuously for entire sheet
JSP code problem - JSP-Servlet
JSP code problem  HI.. I have a DB2 stored procedure wich return a result set. I have made a report basing on this procedure using Crystal Reports. How to pass parameters to this procedure with java code in a JSP page
Task manager enable and disable thru java
Task manager enable and disable thru java  I would like to know, how to enable and disable task manager using java. Kindly, please Let me know
JSP code for registration form
JSP code for registration form  Haiiii can u please tell me how to encrypt password field in registration form and to compare both password and confirm password fields using jsp
Html/JavaScript code - JSP-Servlet
have a table being displayed using the tag and cells in it contain links(huge..., ------------------------------------------ If, you have any problem then , please send me detail with code. Thanks.  ok this is code snippet of JSP1 that is used to display teh table. --JSP1
jsp excel code - JSP-Servlet
jsp excel code  Hi how to insert form data into excel file using jsp?  Hi Friend, Try the following code: 1)register.jsp: Registration Form First Name: Last Name: User Name: Password
EJB in jsp code - EJB
EJB in jsp code  Suppose in EJB we created the session bean, remote interface and the home interface....On the other hand we have a jsp file....how can we access the EJB methods in the jsp file.... if u can present me
Regarding JSP code
interfaces in JSP code I am using Oracle 10g database .Exactly problem with me is that i cant be able to write the code for navigate different users from same login page...Regarding JSP code   hello sir tell me the way to navigate different
java code - JSP-Servlet
java code  hi i have made an application in which i have a fuctionality. in which i get the location of xml files as links on jsp page and when.....and in IE browser i try to access the links they do not open...?why i am
Code - JSP-Servlet
Code  Using servlet,JSP,JDBC and XML create a Web application for a courrier company to provide online help in tracking the delivery status of items
Java or Jsp code - JSP-Servlet
Java or Jsp code  Hello Sir, How to create the code for the password recovery page(like forgot gmail password question and answer page)using... the question and answer page using the radio buttons.please help me to solve
code - JSP-Servlet
code  hi can any one tell me how to create a menu which includes 5 fields using jsp,it's urgent  Hi friend, Plz give details with full source code where you having the problem. Thanks
JSP CODE
JSP CODE  Please help me as soon as possible.Its Urgent. I am working on my college ALUMNI PORTAL. I want to have a ADD FRIEND option in a user's profile. Please send me code
logout code in JSP
logout code in JSP  im using session.invalidate() for logout but its not working
ajax code with jsp - Ajax
ajax code with jsp  hi , Sorry for insufficient data.i m making some correction on question. I have to perform some calculation on my jsp page. i want to do it automatically (using ajax in jsp). problem is - i hv two
JSP Code - Java Beginners
JSP Code  Hi Frnds, I am using a checkbox in my one of page & which is by default checked. Now if i have to use the status of this checkbox... Rai  Hi Friend, Try the following code: 1)checkbox.jsp
jsp code
jsp code  how to display date in drop down list by jsp thus the date start from current date and for next year it has to check leap year function to february then it display 30 for some months else 31 for other months
code for jsp - Ajax
code for jsp  please give code for using jsp page and Ajax.Retrive... country.By using jsp and Ajax.    Hello Friend I send the code you...; Hi friend sorry the jsp page for another program look this file