Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JSP
Value in the else condition is getting printed as the page loads
sanidhya kumar
Greenhorn
Posts: 18
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
<%-- Document : login Created on : 12 Sep, 2012, 4:30:37 PM Author : sanidhya09 --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Login Page</title> <link rel="stylesheet" href="css/margin.css" type="text/css" /> </head> <body background="images/medicallogo.png"> <form name="form" method="post" action="login.jsp" > <table background="images/bg1.gif" id="table" width="1000" height="500" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td> <div id="Header"> <%@ include file="Header2.jsp" %> </div> <div id="body"> <table id="body1" width="750" height="500" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td> <%--Database Connectivity --%> <%@page import="java.sql.*"%> <%@page import="Hospital.Database_Connectivity;"%> <% try{ Connection con; Statement smt; ResultSet rs; String user=request.getParameter("user_id"); String pass=request.getParameter("password"); //Class.forName("com.mysql.jdbc.Driver").newInstance(); //connection =DriverManager.getConnection("jdbc:mysql://localhost:3306/hospital", "root", ""); con=Database_Connectivity.dbcon(); smt=con.createStatement(); rs=smt.executeQuery("select * from login where user_id='"+user+"' and password='"+pass+"'"); if(rs.next()) { while(rs.next()) { String str=rs.getString("type"); if(str.equals("employee")) { response.sendRedirect("index.jsp"); } } } else { out.println("Not valid Credentials"); // response.sendRedirect("login.jsp"); } } catch(Exception ex) { System.out.println("Error="+ex); } %> <p align="center"><font face="Arial Black" color="#800000"><b>PLEASE LOGIN HERE</b></font></p> <table cellpadding="0" cellspacing="0" width="300" height="250" BORDER="0" align="center"> <tr> <td> <font color="#000080" face="arial"/>USERNAME : </td> <td> <input type="text" name="user_id" size="20" id="user_id" /> </td> </tr> <tr> <td> <font face="arial" color="#000080" />PASSWORD : </td> <td> <input type="password" name="password" size="20" id="password" /> </td> </tr> <tr> <td> <font face="arial" color="#000080" />COUNTER : </td> <td> <select size="1" name="Counter"> <option>Counter 1</option> <option>Counter 2</option> <option>Counter 3</option> <option>Counter 4</option> <option>Counter 5</option> </select> </td> </tr> <tr> <td> <font face="arial" color="#000080" />Remember Me : </td> <td> <input type="CHECKBOX" name="checkbox" /> </td> </tr> <tr align="right"> <td> <button name="reset" type="reset" style="background-color:lightseagreen">RESET</button> </td> <td> <button name="login" style="background-color:lightseagreen">LOGIN</button> </td> </tr> </table> </td> </tr> </table> </div> <div id="footer"><br /> <%@ include file="footer2.jsp" %> </div> </td> </tr> </table> </form> </body> </html>
jatan bhavsar
Ranch Hand
Posts: 300
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi Sanidhya,
What is the fetchsize of your resultset?
Regards
Jatan
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
org.apache.jasper.JasperException: java.lang.NullPointerException
Redirecting a page
The requested resource (Servlet action is not available) is not available. ...
problem in running a servlet
INCLUDES.DBconnection error
More...