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



Home Answers Viewqa WebSevices need complete jsp code for transactions using mysql

Have Programming Question? Ask it here!
 
 
 


harshitha
need complete jsp code for transactions using mysql
2 Answer(s)      4 years and 9 months ago
Posted in : WebSevices



Advertisement
View Answers

November 25, 2009 at 2:35 PM


Hi Friend,

We have create two database tables user(id,username,password) and bank(id,username,ano,balance).

Try the following code:

1)login.jsp:

<html>
<head>
</head>
<body>
<form name="loginform" method="post" action="auth.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 colspan=2>&nbsp;</td></tr>
</table>
</form>
</body>
</html>

2)auth.jsp:

<%@ page language="Java" import="java.sql.*" %>
<%
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";;
String dbName = "register";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "root";
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
if(request.getParameter("username")!=null && request.getParameter("username")!="" && request.getParameter("password")!=null && request.getParameter("password")!="")
{
String username = request.getParameter("username");
String userpass = request.getParameter("password");;
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("select * from user where username='"+username+"' and password='"+userpass+"'");
int count=0;
if(rs.next()){ %>
<a href="webpage1.jsp">Cash Transaction</a>
<%
}
else {
response.sendRedirect("login.jsp");
}

}
}
catch(Exception e){}
%>


November 25, 2009 at 2:36 PM


continue....

3)webpage1.jsp:

<html>
<form method="post" action="webpage2.jsp">
<table>
<tr><td>Account No</td><td><input type="text" name="no"></td></tr>
<tr><td>Transfer Amount</td><td><input type="text" name="amount"></td></tr>
<tr><td>To Account No</td><td><input type="text" name="to"></td></tr>
<tr><td><input type="submit" value="submit"></td></tr>
</table>

4) webpage2.jsp:

<%@page import="java.sql.*"%>
<%
int acc1=Integer.parseInt(request.getParameter("no"));
int bal=Integer.parseInt(request.getParameter("amount"));
int acc2=Integer.parseInt(request.getParameter("to"));

try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register";, "root", "root");
Statement st = con.createStatement();

ResultSet rs = st.executeQuery( "select balance from bank where ano='"+acc1+"'");

int balance1=0;
while (rs.next()) {
balance1=rs.getInt("balance");
}
ResultSet rs1 = st.executeQuery( "select balance from bank where ano='"+acc2+"'");

int balance2=0;
while (rs1.next()) {
balance2=rs1.getInt("balance");
}

int bal1=balance1-bal;
int bal2=balance2+bal;

st.addBatch("update bank set balance="+bal1+" where ano='"+acc1+"'");
st.addBatch("update bank set balance="+bal2+" where ano='"+acc2+"'");
st.executeBatch();
out.println("Transaction has been successfully done.");
}
catch(Exception e){}
%>

Thanks


Related Tutorials/Questions & Answers:
need complete jsp code for transactions using mysql - WebSevices
need complete jsp code for transactions using mysql  iam doing online banking project.i want the code to transfer funds from one account to another... to lasya or lasya to prathika. I need complete jsp code for transactions using
urgent need for jsp code with mysql query for uploading and downloading file - JSP-Servlet
urgent need for jsp code with mysql query for uploading and downloading file  can anyone tell me how to upload and download a doc file using jsp with mysql as the back end... and kindly help me to create the table too
Advertisements
need JSP Code.
need JSP Code.  **Hi I need JSP code for selling Products which are in Database. Please can any one help for this.URGENT... Thank You..! Abhijeet
Need a JSP CODE
Need a JSP CODE  *Hi I need JSP source code for selling products which are in database.. please can any one help me ..URGENT* Thank You
Need a jsp code
Need a jsp code  I need a jsp code in which when i select a value.....please help me for this.   The given code retrieves the employee name... =""; if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { var showdata
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...; Mysql database Table. Code to insert row in Mysql table : databaseinsertion.jsp
jQuery auto complete through database using JSP
jQuery auto complete through database using JSP In this tutorial, we will implement auto complete through database using JSP. In this example a text box... it , by completing text using JSP. JSP page take the uncompleted text  form text
jQuery auto complete through database using JSP shows error
jQuery auto complete through database using JSP shows error  The tutorial on jQuery titled "jQuery auto complete through database using JSP" shows error on browser when I try to select the one in the dropdown. Please help
No complete code for AbstractWizardFormCOntroller Example
No complete code for AbstractWizardFormCOntroller Example  No complete codes
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
tree using jsp code
tree using jsp code  i want to draw a tree structure of a family hierarchy using jsp code
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
i need the source code to generate id in jsp
i need the source code to generate id in jsp  hai,i need the source code for generate id...which is i need to generate the new id from the maximum... of generate ids each should have some range...plz give the source code in jsp with ms
need help....how to connect and disconnect multiple databases(databases created in mysql) using java and my sql
in mysql) using java and my sql  i am working on a project on deadlock in distributed transactions , and in that i am using my sql in java i need... such program if u can provide me...plz plz...help i need the idea/code/implementation
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
need to open a file that is in server using jsp
need to open a file that is in server using jsp   im doing a web application where i can upload and download pdf files from server.in this i created... open link it should be opened in jsp.downlaoding part was done by me. wt i need
how to fetch image from mysql using jsp
how to fetch image from mysql using jsp  how to fetch image from mysql using jsp
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
Error in MySQL Procedure Using JAVA Code
Error in MySQL Procedure Using JAVA Code  The following Java code (using Connector/J to create a stored procedure on MySQL 5.0) does not execute successfully. Identify the cause and available solutions. statement.execute
online shopping code using jsp
online shopping code using jsp  plz send me the code of online shopping using jsp or jdbc or servlets plz plz help me
Need Help in creating online quiz application using JSP - JSP-Servlet
Need Help in creating online quiz application using JSP  Hi, i am creating online Quiz application using JSP and MySQl ,Apache 6 in Netbeans IDE. i... ---------------------------------------------------------------------------------------------------- JSP Page
jsp fie execution in tomcat and using mysql - JDBC
jsp fie execution in tomcat and using mysql  I created 2 jsp files..., There is a problem in both JSP pages. If you want to login,try the following code: 1... and password to enter into the Mysql database account.the other named
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
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
how to display jsp page containing mysql query in particular division using ajax ?my code is below bt i cundt get it properly
how to display jsp page containing mysql query in particular division using ajax ?my code is below bt i cundt get it properly   index.html <... will display here</div> </body> </html> print("code sample
need of code
need of code  howto convert greyscale image to binary image in java
need code
need code  Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional... is the required code: import java.util.*; class Vehicle { int
need code
need code  Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional... is the required code: import java.util.*; class Vehicle { int
need code
need code  Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional... is the required code: import java.util.*; class Vehicle { int
complete the code (palindrome) - Java Beginners
complete the code (palindrome)  Write a program that checks if a word.... complete the below code (step 3 and step 4 are not solved). import... is the standard code with full of description,so go according that u will sure find
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
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
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
need a sample project using java technologies like jsp, servlets, struts
need a sample project using java technologies like jsp, servlets, struts  Hi everybody! I have learnt core java,jdbc,jsp,servlets & struts... other project with detailed explanation using the above technologies by which i
No complete code for BeanNameUrlHandlerMapping With Command Class Example
No complete code for BeanNameUrlHandlerMapping With Command Class Example  There is no complete dispatcher-servlet.xml and we couldn't download the codes
Display Blob(Image) from Mysql table using JSP
Display Blob(Image) from Mysql table using JSP In this section, we will display blob data(image) from Mysql database table using JSP code. A Blob stores... : Insert Blob(Image) in Mysql table using JSP Download Source Code
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
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
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
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  
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
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
code for password strength using jsp-servlet
code for password strength using jsp-servlet  hi.............. plz help me to give code for password strength using jsp-servlet for implementation in my project as soon as possible because i want to show this functionality in my
code to send sms alerts using jsp online
code to send sms alerts using jsp online  I am new to mobile aplication development. pls send me the code for sms alerts after clicking the button
Auto complete of word search using ajax with java
Auto complete of word search using ajax with java  I want to display the list of words when I type the first letter of the word in a text box. I am using jsp to design the form. I want ajax sample to achieve this feature. Its
Auto complete of word search using ajax with java
Auto complete of word search using ajax with java  I want to display the list of words when I type the first letter of the word in a text box. I am using jsp to design the form. I want ajax sample to achieve this feature. Its
populating text box using jsp code
populating text box using jsp code  Sir, How to populate related values in a text box after selecting value from drop down list using JSP and mysql.... Please give an example using jsp code only.   dependentDropdown.jsp
need code for file browser
need code for file browser  hi, i need to write a code to browse the file in my computer using Jsp or java.. what is the code for file browser?   JSP Code for browsing: 1)page.jsp: <%@ page language="java" %>
Auto Complete Text Box - JSP-Servlet
Auto Complete Text Box - JSP-Servlet  Auto Complete Text Box Please help me in Aotocomplete text box code. I m a java programmer. I m working on jsp tech. please give me the code for Autocomplete text box in which the values
 

 

 

DMCA.com