null pointer exception in jsp

null pointer exception in jsp

index.html

<html>
<body>
<table align=center>
<form action="Login.jsp" method="get">
<tr>
<td colspan=2><h1>Student Login</h1></td></tr>

<tr>
<td>UserName</td>
<td><input type="text" name="un"></td>
</tr>

<tr>
<td>Password</td>
<td><input type="password" name="ps"></td>
</tr>

<tr>
<td><input type="Submit" value="Login"></td>
</tr>
</form>
<table>
</body>
</html>


Login.jsp

      <%@ page import="java.sql.*" %>
    <%!
    Connection con;
    public void Conn()
    {
    try
    {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","system","oracle");
    }
    catch(Exception e)
    {
    System.out.println(e);
    }
    }


    %>

    <html>
    <body>
    <%
    try
    {
    String un,ps;
    int flag=0;
    un=request.getParameter("un");
    ps=request.getParameter("ps");
    Conn();
    Statement st=con.createStatement();
    String view="select * from Login";
    ResultSet rs=st.executeQuery(view);
    while(rs.next())
    {
    if(un.equals(rs.getString(1)) && ps.equals(rs.getString(2)))
    {
    flag=1;
    break;
    }
    }

    if(flag==1)
      {
       RequestDispatcher rd=request.getRequestDispatcher("Login1.jsp");
    rd.forward(request,response);
    }    
    else{  
    RequestDispatcher rd=request.getRequestDispatcher("index.html");
    rd.include(request,response);
    }
    }
    catch(Exception e)
    {
    out.println(e);
    }
    %>
    </body>
    </html>



when I am runnning this project getting **java.lang.NullPointerException** error , please see and resolve
View Answers









Related Tutorials/Questions & Answers:
null pointer exception in jsp
null pointer exception in jsp  index.html <html> <...(Exception e) { System.out.println(e); } } %>...); } } catch(Exception e) { out.println(e); } %>
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Advertisements
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Null pointer exception error in Jsp - JSP-Servlet
Null pointer exception error in Jsp  Hi i write a login page. when i validate the login value then the nullpointer exception error is occured. my..." attributes in the input tag So id,userpwd gives null pointer exception
Null pointer exception error in Jsp - JSP-Servlet
Null pointer exception error in Jsp  Expert:Majid Hi i write a login page. when i validate the login value then the nullpointer exception error..." attributes in the input tag So id,userpwd gives null pointer exception. Thanks
null pointer exception in java
null pointer exception in java  What is null pointer exception in Java and when it occurs? Show it with an example.Thanks!   Java Null Pointer Exception
Httpservletresponse null pointer exception.
Httpservletresponse null pointer exception.  What is Httpservletresponse null pointer exception?   NullPointerException occurs when we try to implement an application without referencing the object and allocating
Null Pointer Exception
Null Pointer Exception  whis is the Null Pointer Exception in java? or define Null Pointer Exception with exp?   NullPointerException occurs, when you try to implement an application without referencing the object
NULL POINTER EXCEPTION
NULL POINTER EXCEPTION    What is the Root cause for Class caste exception in struts frame work .and how 2 handle that 1 please help me
what is a null pointer exception in java
what is a null pointer exception in java  what is a null pointer exception in java
NUll POINTER EXCEPTION
of code i m getting null pointer Exception. can some one please explain what...NUll POINTER EXCEPTION  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
Java null pointer exception
Java null pointer exception  Hi I've made an array of Book objects that I made, the array is called library and it can hold 100 books, but currently...]!=null){ if(strfield.contains(param)){ result+=library[counter
Null pointer exception in hibernate - Hibernate
Null pointer exception in hibernate  Hi i am getting null pointer... is compiled successfully but while running the program i am getting null ponter exception. SessionFactory object is not creating pls give me the solution
Java null pointer exception handling
Java null pointer exception handling   What... program? Is this extends from exception class of Java?   Java null pointer exception handling What is Java NullPointerException? In Java
Null Pointer Exception - Java Beginners
Null Pointer Exception  How Can I Handle NullPoiniterException without using try/catch mechanism
null pointer exception cannot be removed
null pointer exception cannot be removed  class list { public... Exception nothing; public int r; public list() { this(null,null,0); } public list(String e,int i) { this.elem = e; this.next = null
Handle Null Pointer Exception while text file upload
Handle Null Pointer Exception while text file upload  I want the code for handling null pointer exception in jsp page. That is I need an error page for null pointer exception. The cause for null pointer exception is while
Null Pointer Exception
Null Pointer Exception        Null pointer exceptions are the most common run time ... 3.Point out the reason for null. Understand Null Pointer Exception Suppose we have
Why the null Pointer exception is comming? - Java Beginners
Why the null Pointer exception is comming?  My code is given below...")); String []oldOne = null; String[]newOne; int i = 0...}; String line; String line1; String[] tokens = null
when do we get null pointer exception in java
when do we get null pointer exception in java  can anybody explain me abt null pointer exception? like in wt situation do v get NPE? Are these 2 strings same? String str; String str=null
null pointer
null pointer  dear sir , what is mean by null pointer in c
Null pointer execption
Null pointer execption  what is null pointer exception. I am getting the null pointer exception in this line conn= com.mypay.dao.Connection.getConnection(); what is wrong
Null pointer execption
Null pointer execption  what is null pointer exception. I am getting the null pointer exception in this line conn= com.mypay.dao.Connection.getConnection(); what is wrong
Clicking F5 and reentering value throws Null pointer exception
Clicking F5 and reentering value throws Null pointer exception  Hi, My page performs search operation.Normally when i enter a value and click... refresh my page and enter any value it is throwing Null pointer exception.can
check null exception java
check null exception java  check null exception java - How to check the null exception on Java?   The null pointer exception in java occurs... on it. See the example null pointer exception
null pointer exceptions
null pointer exceptions  import java.util.*; public class employee { static int ch; static int emp[]; String name; int id,age..."); } } } Exception in thread "main" java.lang.NullPointerException at employee.insert
null pointer error
null pointer error  Respected sir there is a problem in this code when i add any new record in ms access data base from my code, it gives only null pointer error sir please help me my code are given below compilatation class
null pointer error
null pointer error  Respected sir there is a problem in this code when i add any new record in ms access data base from my code, it gives only null pointer error sir please help me my code are given below compilatation class
Pointer in java - JSP-Servlet
Pointer in java   Hello ! All i know that java has no pointer type facility. but i have a problem to related pointer. Actually m using a dll and in that dll there is function that rec add of byte type variables address
Handling exception in jsp - JSP-Servlet
=DBGrantOrRevoke.getLpoInfo(loginpersionId); suppose List is null i am sending this exception to jsp. (this is ok) Now i need to handle this exception in my jsp...Handling exception in jsp  Hi Here is the sample code of servlet
exception in jsp - JSP-Servlet
exception in jsp  hi my code is given below.while running that code i got exception like given below.plz any body help me HTTP Status 500... Exception report message description The server encountered
JasperException: Exception in JSP
org.apache.jasper.JasperException: Exception in JSP: /UserMonitor.jsp:23 20: <input type="submit" value...JasperException: Exception in JSP  Hi, I am facing below problem while getting paramater as int from jsp. Same code is working fine for string
Handling exception in jsp - JSP-Servlet
Handling exception in jsp  Hai..... Could you please tell me "How to handle Servlet Exception object in jsp pages?"  Hi friend, For solving the problem visit to : http://www.roseindia.net/jsp
Handling exception in jsp - JSP-Servlet
Handling exception in jsp  In my servlet i have an exception object. I am passing that object to jsp error page, But i am unable to handle that exception in my jsp page. Server is showing some error other than my error page
Getting an exception - JSP-Servlet
of a is " + f); } } //following is an exception org.apache.jasper.JasperException: An exception occurred processing JSP page /jsp/newTestMES3.jsp at line...(); if (session.getAttribute("ArrayValue") != null) { arlValue = (ArrayList
Refresh Button returns null point exception when clicked
Refresh Button returns null point exception when clicked  Dear all... button in java. When clicking the button it returns an error "null point exception" Thanks
pointer
pointer  CONSTRTUCT A STRUCTURE FOR EMPLOYEE RECORD THAT CONTAINS A PERSON'S NAME, AGE, EMPLOYEE AND SALARY.WRITE A STATEMENT THAT DECLARES A VARIABLE empInfo and a pointer emPtr of type EMPLOYEE.then use the pointer to display
Getting an exception - JSP-Servlet
Getting an exception  sir i m Getting an following exception while... sending message; nested exception is: java.io.FileNotFoundException...=null; boolean isSent=true; String host = " "; String fromMail =from
Jsp.jasper exception - JSP-Servlet
Jsp.jasper exception   Thank for u answer for yesterday question I am geeting an exception while running the code exception... Source) org.apache.jsp.add3_jsp._jspService(org.apache.jsp.add3_jsp:89
<%=request.getHeader("referer")%>,getting null in jsp - JSP-Servlet
,getting null in jsp  Hi, I am getting null in in jsp.Could you help on this regards. Thanks Ajay   Hi friend, Code to help in solving the problem : Thanks
Exception handling - JSP-Servlet
Exception handling  I have added DSN 'online_exam' in Administrative... the following exception type Exception report message description The server.... exception org.apache.jasper.JasperException
Null pointer exceptation-Java Servlet web application,Problem connecting with MYSQL database
Null pointer exceptation-Java Servlet web application,Problem connecting... { private static ConnectionPool pool = null; private static DataSource dataSource = null; private ConnectionPool
Getting an exception - JSP-Servlet
exception please help me sir if an changes tel me sir thanks in advance...) at org.apache.jsp.jsp.ReadExcelFile_jsp._jspService(ReadExcelFile_jsp.ja va:70...); } cellVectorHolder.addElement(cellStoreVector); } } catch (Exception e
NullPointer Exception - JSP-Servlet
NullPointer Exception  It is in jsp - mysql database program. In this pro. it enters into the statement before try statement. It does not enter...)session.getAttribute("deptno"); out.println(deno); is it printing properly may be null
Nullpointer Exception - JSP-Servlet
of the servlet program? how can i solve this exception ? HTTP Status 500... Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception
Exception - JSP-Servlet
Exception  Hi team, This is Ragavendran.R. I am getting java.lang.StringIndexOutOfBoundsException: String out of range : 6 error while compiling the following program in JSP charting application: Plz reply
Getting an exception - JSP-Servlet
Getting an exception  Dear Sir , While sending a mail am getting an following exception javax.mail.MessagingException: 554 mail server permanently rejected message (#5. 3.0)so how to over come from this please help
method returning null on JSP page.Plz HELP!!!
method returning null on JSP page.Plz HELP!!!  public String... on the jsp page it is returning null while the parameter values are successfully... sAddress = null; if(sPort>=0) { sAddress

Ads