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



Home Answers Viewqa JSP-Servlet jsp using include & with mysql

Have Programming Question? Ask it here!
 
 
 


Prateek Mishra
jsp using include & with mysql
1 Answer(s)      3 years ago
Posted in : JSP-Servlet


Sir,

I am creating a login application using jsp & Mysql. 

The Codes are---


Html File......


<html>
<head><title>LOGIN APPLICATION</title></head>
<body bgcolor="sky blue">
<font color="red"><b><blink>PLEASE ENTER THE USERID AND PASSWORD...........</blink></b></font>
<br>
<br>
<form method="get" action="login.jsp">
Enter UserId:<input type="text" name="userId"><br>
Enter Password:<input type="password" name="password"><br><br><br>

<input type="submit" value="LOGIN">
</form>
</body>
</html>


Jsp file.......

<%@ page import="java.sql.*" %>

<%

String mailid=request.getParameter("userId");
String password=request.getParameter("password");

Class.forName(application.getInitParameter("driverclass"));

Connection con=DriverManager.getConnection(application.getInitParameter("url"),application.getInitParameter("user"),application.getInitParameter("password"));

PreparedStatement stmt=con.prepareStatement("Select name from userinfo where mailid=? and password=?");

stmt.setString(1,mailid);
stmt.setString(2,password);

ResultSet rset=stmt.executeQuery();

if (rset.next())
{
    out.println("Welcome"+rset.getString(1));
}
else
{
    out.println("Invalid Userid Or Password.");

    %>

<%@ include file="login.html" %>

        <%
}
        out.close();
        %>



  WEB.xml...........

<web-app>

<context-param>
<param-name>driverclass</param-name>
<param-value>com.mysql.jdbc.Driver</param-value>
</context-param>

<context-param>
<param-name>url</param-name>
<param-value>jdbc:mysql://localhost:3306/userinfo</param-value>
</context-param>


<context-param>
<param-name>url</param-name>
<param-value>root</param-value>
</context-param>

<context-param>
<param-name>url</param-name>
<param-value>root</param-value>
</context-param>

</web-app>

It will producing error like...........

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NullPointerException
    java.lang.Class.forName0(Native Method)
    java.lang.Class.forName(Class.java:164)
    org.apache.jsp.login_jsp._jspService(login_jsp.java:55)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

Please tell me the complete solution.


  Thanks,,,,

Advertisement
View Answers

August 8, 2011 at 1:21 PM


It seems that application doesn't find mysql connector jar file. Download it and put it into lib of jdk and in tomcat lib.

Please go through the following link:

JSP Login Application



Related Tutorials/Questions & Answers:
jsp using include & with mysql
jsp using include & with mysql  Sir, I am creating a login application using jsp & Mysql. The Codes are--- Html File...... <...; Jsp file....... <%@ page import="java.sql.*" %> <% String
difference between <%@ include ...> and <jsp:include>
difference between <%@ include ...> and   What is the difference between <%@ include ...> (directive include) and <jsp:include>
Advertisements
jsp:include page=.. and include file = ...
jsp:include page=.. and include file = ...   What is the difference between <jsp:include page = ... > and <%@ include file = ... >?.   <jsp:include page = ... >: This is like a function call from
JSP include directive tag
JSP include directive tag  What is include directive tag in JSP
include a jsp file
include a jsp file   Sir, I have 2 jsp pages. I want to include second jsp in the first jsp page when a button in the first jsp is clicked. how can I do this. I tried in sevaral ways . I am using jsp and javascript... anyone
JSP include directive tag
JSP include directive tag  What is include directive tag in JSP?   Hi, The JSP include directive includes a static file or sends a request to a dynamic file. or The JSP include directive is used to include
Dynamic include jsp
Dynamic include jsp  I need dynamic include jsp page with an example
jsp include action tag
jsp include action tag  Defined jsp include action tag ?   The <jsp:include> element allows you to include either a static or dynamic... that is included in the JSP page. When the include action is finished, the JSP
login page with mysql using jsp
login page with mysql using jsp  pls i need a sample of login page to check username and password in mysql database. thanks
how to fetch image from mysql using jsp
how to fetch image from mysql using jsp  how to fetch image from mysql using jsp
Jsp include page problem
Jsp include page problem  I have included footer.jsp in all my pages. It is working in all pages except search.jsp. In search.jsp (Old footer.jsp... the cache files in your server's work folder. If you are using tomcat, then you
Passing Parameter with <jsp: include>
a file in a jsp page. While using <jsp:param> we are adding...--> <jsp:include page="AccessincludedParameter.jsp"> <jsp...Passing Parameter with <jsp: include>     
jsp:include action tag
jsp:include action tag In this section we will discuss about JSP "include" action tag. The jsp "include" tag is used to include... into Servlet. The include tag is used to include another resource it may be jsp
JSP Include jsp
JSP Include jsp   ... include either a static or dynamic file in a JSP file. If the file is static, its...;Includes Jsp Page</h2> <jsp:include page="includedJsp.jsp" >
Image upload in mysql database using jsp servlet
Image upload in mysql database using jsp servlet  Hello, I need code to insert image in mysql database, I have seen the code which is already in your... located inside the application, but i need to upload in mysql and also for inserting
upload csv to mysql db using jsp upload
upload csv to mysql db using jsp upload  Hello all, Please give me the code to uplad .csv from jsp page and insert values into MySQl db. I have a table with 8 cloumns.(MDN--varchar(30),Otafdate date,crt varchar(30),dmdn
JSP include
JSP include       A JSP page can include page fragments from other files to form the complete... the action:   <jsp:include page=" relative URL" flush="true"
login page using jsp servlrt with mysql database?
login page using jsp servlrt with mysql database?  Description: example:total users are 3.each use have username and password save in mysql database table login. After successfully login user1 see only index page,if user2 login
The Include Directive in JSP Page
The Include Directive in JSP Page   ... directive of the JSP. You will learn about what is include and how to implement...; <%@include file="relativeURL" %> <jsp:include page="
Exporting data from mysql into csv using jsp
Exporting data from mysql into csv using jsp  Hi friends.... I want to export the data from mysql to csv file using... i am having 30 columns in my... want csv file with 10 rows.. i want to do in jsp... pls help me soon..its very
jsp fie execution in tomcat and using mysql - JDBC
jsp fie execution in tomcat and using mysql  I created 2 jsp files... and password to enter into the Mysql database account.the other named...:THE LAST JSP PAGE IS COMING DIRECTLY ON EXECUTION IN TOMCAT
How to include a File using directive and include action
; <h1>Using the include action</h1> <jsp:include page = "...How to include a File using directive and include action... one attribute named as file, which is used to include a file in the jsp page
get info from mysql using jsp and servlet
get info from mysql using jsp and servlet  HELLO! I wanna create a jsp page which able to let me get its name, phone and other info by asking the user to key in their email address from mysql database by using servlet and jsp too
Read Excel data using JSP and update MySQL databse
Read Excel data using JSP and update MySQL databse  HOw to read excel data using JSP and update MySQl database
flush attribute in jsp:include tag - JSP-Servlet
flush attribute in jsp:include tag  what is the use of flush attribute in jsp:include tag ?  hi friend, ------------------------------ Read for more information, http://www.roseindia.net/jsp
Upload Exce Data into MySql Using Jsp and Servlet - JSP-Servlet
Upload Exce Data into MySql Using Jsp and Servlet  now i am doing... into Mysql Database table so please give the coding to me, it's very urgent for me... the following link: http://www.roseindia.net/jsp/upload-insert-csv.shtml Hope
insert name city and upload image in database using mysql and jsp
insert name city and upload image in database using mysql and jsp   insert name city and upload image in database using mysql and jsp
JSP Include Param
JSP Include Param          JSP Include Param is used to pass parameter in the include directive. The example uses <jsp:param> clause to pass
Include static files within a JSP page
using the JSP include directive. This way, the inclusion is performed just once...Include static files within a JSP page  How do I include static files... for the file attribute. Although you can also include static resources using
access image from ajax store in mysql using jsp
access image from ajax store in mysql using jsp  access image from ajax store in mysql using jsp (code to access image captured by camera and store in mysql
The "include" directive of JSP
will discuss about "include" directive of JSP with an example. The include... application.Contents of the include file is added to the calling JSP page if the resource...;html> <head><title>Include Directive JSP Page.</title><
JSP Include File
JSP Include File          JSP Include File is used to insert a html... to include a html file in the jsp page. You can see in the given example that we
how to include a java class in jsp - JSP-Servlet
how to include a java class in jsp  hello sir, this is my first... to use those variables in my jsp for further process... ?? is it possible..?? suggestions are heartly welcomed.  Hi friend, Using
Using javabeans to connect mySQL database on a jsp page - JSP-Interview Questions
Using javabeans to connect mySQL database on a jsp page  Hi, Am doing......; Connecting a JSP page to MYSQL Database using JavaBean File Name: beancode.java   Connecting a JSP page to MYSQL Database using JavaBeanFile Name
JSP include directive tag syntax and example
JSP include directive tag syntax and example  The syntax and example of the JSP include directive tag.   Hi, The syntax of the JSP include... of the JSP include directive tag is: <%@include file="filename" /> Thanks
Include Static HTML Page in JSP
html page in jsp. In JSP, there are two ways to include another web resource. 1. include directive and  2. jsp:include element. Using include directive... Include Static HTML Page in JSP   
retrive the employee details with image from mysql database using jsp servlet
retrive the employee details with image from mysql database using jsp servlet  im doing the web project to retrive the employee profile which i stored in the database using jsp servlet then want to show the result in the next jsp
JSP &MYSQL
JSP &MYSQL  Develop a web page for the telephone directory using jsp and mysql
Using MYSQL Database with JSP & Servlets.
Using MYSQL Database with JSP & Servlets.  ... acceres the MYSQL database. Here I am using MYSQL & tomcat server... current command   quit (\q)  Quit mysql  
retrieve related data from database using jsp and mysql
retrieve related data from database using jsp and mysql  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list. if we change a value in a dropdown its related value must
Data needs to be gathered in XML file from the database (MySql) using JSP
in XML file from the database (MySql) using appropriate JSP/Java Bean functions...Data needs to be gathered in XML file from the database (MySql) using JSP ... files. using following database create database music; use music; CREATE
how to upload an image from a jsp page to a mysql database table using jsp
how to upload an image from a jsp page to a mysql database table using jsp  how to upload an image from a jsp page to a mysql database table using jspstrong text
insert name city image in database using mysql and jsp
insert name city image in database using mysql and jsp  how to insert name ,city and image in database in mysql and jsp   Here is an example in jsp that insert name, city and image to database. <%@ page import
need complete jsp code for transactions using mysql - WebSevices
need complete jsp code for transactions using mysql  iam doing online... to lasya or lasya to prathika. I need complete jsp code for transactions using mysql.  Hi Friend, We have create two database tables user(id,username
Insert a row in 'Mysql' table using JSP Code
Insert a row in 'Mysql' table using JSP Code In this section, we will discuss about how to insert data in Mysql database using JSP code. Query...), Phone varchar(15), primary key(ID) ); NOTE : Download Mysql
How To Include Two Jsp page in another jsp page?
How To Include Two Jsp page in another jsp page?  I use following code to Include Two Jsp Page Header and footer <%@include file="header.jsp... the following links: http://www.roseindia.net/jsp/jsp-include-file.shtml http
fetch and insert multiple rows into mysql database using jsp servlet
fetch and insert multiple rows into mysql database using jsp servlet  ... jsp form and want inserting it into my mysql database table. but i am having a problem to insert multiple rows into database using a single insert query
JSP-Mysql - JSP-Servlet
JSP-Mysql  Hello friends, Anyone send me the way how to store image in mysql database from a jsp page.  Hi friend, Code to insert image in mysql Using Jsp : For more information on JSP
Creating dynamic jsp file in java file to include another jsp file
Creating dynamic jsp file in java file to include another jsp file  I........ Need to include jsp file in the same content. The below code doesn't help me " jsp:include page="pageValue" " Please help. Thanks In Adv.  
Insert Blob(Image) in Mysql table using JSP
Insert Blob(Image) in Mysql table using JSP In this Section, we will insert blob data(image) in Mysql database table using JSP code. A Blob stores a binary... Blob(Image) in Mysql table using JSP Download Source Code
Advertisements
 

 

 

DMCA.com