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



Home Answers Viewqa JDBC jsp fie execution in tomcat and using mysql

Have Programming Question? Ask it here!
 
 
 


souumitra sikder
jsp fie execution in tomcat and using mysql
2 Answer(s)      5 years and a month ago
Posted in : JDBC



Advertisement
View Answers

July 7, 2009 at 12:23 PM


Hi Friend,

There is a problem in both JSP pages.
If you want to login,try the following code:

1)form.jsp:
<html>
<head>
<title>User Login</title>
<style type = "text/css">
body
{ font-family: tahoma, helvetica, arial, sans-serif; }
table, tr, td
{ font-size: .9em;
border: 3px groove;
padding: 5px;
background-color: #dddddd;
}
</style>
</head>
<body>
<form method = "post" action = "userLogin.jsp">
<p>Enter The User Name and Password to Log into our Student Database</p>
<table>
<tr>
<td>User name</td>
<td>
<input type = "text" name = "username" />
</td>
</tr>

<tr>
<td>Password</td>
<td>
<input type = "password" name = "password" />
</td>
</tr>
<tr>
<td colspan = "2">
<input type = "submit" value = "Log In" />
</td>
</tr>
</table>
</form>
</body>
</html>
2)userLogin.jsp:
<%@ page import = "java.sql.*" %>
<%@ page errorPage = "userDataviewErrorpage.jsp" %>
<%
String name1 = request.getParameter( "username" );
String name2 = request.getParameter( "password" );

Connection connection = null;
Statement statement = null;
Class.forName( "com.mysql.jdbc.Driver");

connection = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test";, "root", "root" );
statement = connection.createStatement();

ResultSet resultSet = statement.executeQuery("SELECT * from login where username='"+name1+"' and password='"+name2+"'" );
if(resultSet.next()){
out.println("Welcome"+name1);
}else{
out.println("Invalid Username or Password");
}
%>

3)userDataviewErrorpage.jsp:
<%@ page isErrorPage = "true" %>
<html>
<head>
<title>Error!</title>

<style type = "text/css">
.bigRed
{font-size: 2em;
color: red;
font-weight: bold;
}
</style>
</head>
<p class = "bigRed">

The error message was: <br />
<%= exception.getMessage() %>
</p>
<p class = "bigRed">Please try again later</p>
</body>
</html>

The username and password that we used in the JDBC Connection are the MySql username and password.The code we have provided you checks whether the entered username and password is valid or not.

Thanks


July 7, 2009 at 12:29 PM


continue..........

And If you want to insert the new username and password,then try the following code:

<%@ page import = "java.sql.*" %>
<%@ page errorPage = "an.jsp" %>
<%
String name1 = request.getParameter( "username" );
String name2 = request.getParameter( "password" );

Connection connection = null;
Statement statement = null;
Class.forName( "com.mysql.jdbc.Driver");

connection = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test";, "root", "root" );
statement = connection.createStatement();
int i=statement.executeUpdate("Insert into login(username,password) values('"+name1+"','"+name2+"')");

%>

For more information,please visit the following link:

http://www.roseindia.net/jsp/javascriptpagerefresh.shtml
http://www.roseindia.net/jsp/loginstatus.shtml

Hope that it will be helpful for you.
Thanks


Related Tutorials/Questions & Answers:
jsp fie execution in tomcat and using mysql - JDBC
jsp fie execution in tomcat and using mysql  I created 2 jsp files and kept them under a new directory in the web-apps subdirectory of Tomcat's...:THE LAST JSP PAGE IS COMING DIRECTLY ON EXECUTION IN TOMCAT
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...... <... and in tomcat lib. Please go through the following link: JSP Login Application
Advertisements
netbeans with mysql and tomcat
netbeans with mysql and tomcat  Hi. I have to run a JSP or JAVA file in netbeans with mysql database and tomcat server 7.0. But while the page loading itself it say error. ClassNotFoundException: com.mysql.jdbc.Driver. How
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
execution - JSP-Servlet
execution  hi, i am venkata ramesh, after complition of my servlet program, i start tomcat server(8080),using http://localhost:8080 ,but output... type 'admin' only, i am not given any password to tomcat server. how to execute
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 tomcat hosting
JSP tomcat hosting  Hi, What is JSP tomcat hosting? Thanks  ... application on internet. But if you are using Tomcat to host the applications then the hosting environment is called as jsp tomcat hosting. There are many
Manipulation of war fie contents
Manipulation of war fie contents  How can I manipulate a specific file inside my war file without extracting it? Please help... Thanks and regards, Swapnil
Error in connecting to the mySQL database in TOMCAT using more than one PC (database connection pooling)
Error in connecting to the mySQL database in TOMCAT using more than one PC...="com.mysql.jdbc.Driver" url="jdbc:mysql://10.9.58.8:3306/alcs_htht"/> </Context>... to successfully connect using one PC. But when I use another PC to access
tomcat jsp call DLL
tomcat jsp call DLL  Where can i find Example of use JSP under Tomcat environment call DLL
tomcat - JSP-Interview Questions
tomcat  how to run a program of jsp using tomcat server.please give... the tomcat, create a folder 'application' into C:\apache-tomcat-6.0.16... that create a jsp file 'hello.jsp'and put into the 'application' folder. To start
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
tomcat cache - JSP-Servlet
tomcat cache  hai friends i have a query that is i want to remove the cache memory from Tomcat server Automatically using jsp without deleting it manually from work folder because every time when i make any changes
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
tomcat - JSP-Servlet
tomcat  i want to run my war file in server in tomcat... to how to assign static IP in tomcat.... i want to run my project in local-network... my project is in jsp
How to connect mysql with jsp
How to connect mysql with jsp  how to connect jsp with mysql while using apache tomcat
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
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
execution time calculation - JSP-Servlet
execution time calculation  I want to know how to find out execution time of an algorithm in java thread program.Pls send me an example of a thread program in which i can calculate the execution time of my program.  Hi
tomcat - JSP-Servlet
servlet using tomcat 5 from the start..   Hi friend, Set... the environment variable by using the following steps. Go to Start->Control Panel... the values as Variable Name: CLASSPATH Variable Value: C:\Program Files\Java\Tomcat
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  
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
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
tomcat - JSP-Interview Questions
tomcat   i have installed tomcat server but i have not got tomcat6.exe file in the bin directory.although i have got the icon (of apache tomcat... file after downloading tomcat server,then put it into C:\\ directory and extract
Tomcat error - JSP-Servlet
Tomcat error  Sir I have Installed Tomcat 6.0 om my personel computer havind Operating system windows xp. But when I start the tomcat it gives the error :-this is non microsoft product please see event log . what might
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
tomcat problem - JSP-Servlet
tomcat problem  Hi! Rose India Team, I am unable to install the tomcat server. It stops at this stage during installation .......c:\program files... installed several times and worked successfully on tomcat but this time it stops
connect jsp with tomcat - JSP-Servlet
connect jsp with tomcat  hello friends, i have severe problem in making connection between tomcat 6.0.18 and jsp pages.my system configuration... already set) ->tomcat 6.0.18 (c:/tomcat/tomcat6.0/) I have my site folder
ecclipse_tomcat - JSP-Servlet
have java also installed.. How can I configure Tomcat for ecclipse...For running a small applcation..  Procedure to configure Tomcat in eclipse Go... runtime click on add button on the right side panel choose Apache Tomcat
Tomcat with quartz by using eclipse ide
Tomcat with quartz by using eclipse ide  Hai friends I am in a position to run a simple quartz hello job program in eclipse by using tomcat server. when i run this in tomcat server it shows 404 error that is resources
connection of jsp with mysql - JSP-Servlet
connection of jsp with mysql  can anybody tell me about connection of JSP with MYSQL? and also tell me which version is compatible with tomcat 4.1 i am using tomcat 4.1, MYSQL 5.0 but i have problem with connection
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
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
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
apache tomcat problem - JSP-Servlet
apache tomcat problem  hi, i am trying to run apache tomcat...\;"; i installed my apache tomcat in c: whats wrong with this  ...-tomcat-6.0.18\;" instead of using "CATALINA_HOME=C:\apache-tomcat-6.0.18\bin
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
JSP, Tomcat apche6, Crimson Editor - JSP-Servlet
JSP, Tomcat apche6, Crimson Editor  Hello, some additional in my first question. how can i use JSP, Apache Tomcat 6 and crimson editor to save my data. please teach me step by step regarding to this question. thanks a lot
MySQL Generate AlphaNumberic Id In JSP
numeric id using MySQL as database, tomcat 7 as a server for deploying the JSP...MySQL Generate AlphaNumberic Id In JSP In this section we will discus about how to generate id in specific format in MySQL and JSP. This example explains
Tomcat
Tomcat  to run one application in tomcat server which files we need.i think jsp,xml,html is sufficient
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
Tomcat installation problem - JSP-Servlet
Tomcat installation problem   Hello I have installed Tomcat... tomcat homepage "http://localhost:8000/"..I am awaiting for response..Thanks...:\apache-tomcat-6.0.16; 2) Put the servlet-api.jar into lib folder of apache tomcat
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
Tomcat
Tomcat  I am using UBUNTU and I want to install tomcat to run servlet programs
 

 

 

DMCA.com