can u plz try this program

can u plz try this program

View Answers

November 18, 2008 at 12:28 AM

Hi friend,

form code
------------------
<html>



<head>



<title>User information</title>

</head>



<body>

<br><br><br>

<div align="center">

<center>

<table border="1" cellpadding="0" cellspacing="0" width="400px" height="69">

<tr>

<td width="859" height="69">

<form method="POST" action="userInfomAction.jsp">



<h1 align="center">&nbsp;User Information Form</h1>

<div align="left">

<table border="1" cellpadding="0" cellspacing="0" width="400px">



<tr>

<td width="50%"><b>Name:</b></td>

<td width="50%"><input type="text" name="name" size="20"></td>

</tr>

<tr>

<td width="50%"><b>Last Name:</b></td>

<td width="50%"><input type="text" name="lsname" size="20">

</td>

</tr>

<tr>

<td width="50%"><b>Age :</b></td>

<td width="50%"><input type="text" name="age" size="10">

</td>

</tr>



</table>

</div>

<p align="center"><input type="submit" value="Submit" name="submit">

<input type="reset" value="Reset" name="B2"></p>

</form>

<a href="showDataAction.jsp"><b>Click for Show Data</a></b>

</td>

</tr>

</table>

</center>

</div>



</body>



</html>


-------------------------

November 18, 2008 at 12:29 AM

data insert action code:
----------------------------

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



<%

Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String pass="amar123";



try{

Class.forName(driver);

con = DriverManager.getConnection(url+db,userName,pass);



try{

Statement st = con.createStatement();

String name = request.getParameter("name");

String lsname = request.getParameter("lsname");
String age = request.getParameter("age");



int val = st.executeUpdate("insert into userinform(name,lsname,age) values('"+name+"','"+lsname+"','"+age+"')");

con.close();

out.println("Successfully insert data into Database");

}



catch(SQLException ex){

System.out.println("SQL satatment not found");

}

}

catch(Exception e){

e.printStackTrace();

}

%>

<br>

<a href="userInform.jsp">Home Page</a>

---------------------------------------


November 18, 2008 at 12:30 AM

Data display code:

----------------------------

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

<html>

<head>

<title>display data</title>

</head>

<body>

<center>

<H1>Display Record From Database<H1>

<br>

<table border="1" cellpadding="0" cellspacing="0" width="500px" height="69">

<tr>

<td></td>

</tr>

<tr>

<td><b>Id<b></td>

<td><b>Name<b></td>

<td><b>Last Name<b></td>
<td><b>Age <b></td>

<td><b>Delete<b></td>
<td><b>Edit<b></td>

</tr>



<%

Connection con = null;

String url = "jdbc:mysql://192.168.10.211:3306/";;

String db = "amar";



String driver = "com.mysql.jdbc.Driver";

String username = "amar";

String password = "amar123";



try{

Class.forName(driver);

con = DriverManager.getConnection(url+db,username,password);



try{

Statement st = con.createStatement();

String sqlQuery = "Select * from userinform";

ResultSet rs = st.executeQuery(sqlQuery);

int sno = 0;

while(rs.next()){

sno++;

%>



<tr style="background-color:#CCFFFF;">

<td><%=sno%></td>

<td><%=rs.getString("name")%></td>

<td><%=rs.getString("lsname")%></td>
<td><%=rs.getString("age")%></td>

<td><a href = "deleteAction.jsp?id=<%=rs.getInt("id")%>">Delete</a></td>
<td><a href = "Updaterecord.jsp?id=<%=rs.getInt("id")%>">Edit</a></td>

</tr>



<%



}



rs.close();

con.close();

st.close();

}

catch(SQLException ex){

System.out.println("SQL satatment not found");

}

}

catch(Exception e){

e.printStackTrace();

}

%>



</table>

<a href="userInform.jsp">Home Page</a>

</center>

</body>

</html>

November 18, 2008 at 12:31 AM

Data delete action code:

-----------------------

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



<%

Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String pass="amar123";



String id=request.getParameter("id");

System.out.println("id:"+id);

try{

Class.forName(driver);

con = DriverManager.getConnection(url+db,userName,pass);



try{

Statement st = con.createStatement();



String sqlQuery = "delete from userinform where id="+id;

int delete = st.executeUpdate(sqlQuery);

con.close();

out.println("Successfully Delete data into Database");

}



catch(SQLException ex){

System.out.println("SQL satatment not found");

}

}

catch(Exception e){

e.printStackTrace();

}

%>

--------------------------------

November 18, 2008 at 12:32 AM

Data edit code.
---------------------

<%@ page language="java" import="java.io.*, java.sql.*" %>
<%
int id=0;
Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String password="amar123";



String name="";
String lastName="";
String age = "";
if(request.getParameter("id")!=null && request.getParameter("id")!="")
{

id = Integer.parseInt(request.getParameter("id").toString());


try{

Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,password);

Statement st = con.createStatement();

String sqlQuery = "Select * from userinform where id="+id;
System.out.println("sqlQuery>>>>>>>" + sqlQuery);

ResultSet rs = st.executeQuery(sqlQuery);
if(rs.next())
{
name = rs.getString(2);
lastName = rs.getString(3);
age = rs.getString(4);
}
}
catch(Exception e) {
System.out.println(e.getMessage());
}

}
%>
<html>
<head>
<title>update record</title>
</head>
<body>
<center>
<table border="0" width="400px" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<center>
<h2><font color="#FF0033">Update data into database</font></h2></center>
<form name="updateForm" action="updateRecordAction.jsp" method="GET" >
<input type="hidden" name="id" value="<%=id%>">
<table border="1" width="400px" cellspacing="0" cellpadding="0" bgcolor="#CCFFCC">
<tr>
<td width="50%"><b>Id:</b></td>
<td width="50%" valign="right">
<input type="text" name="id" value="<%=id%>"> </td></tr>
<td width="50%"><b>Name</b></td>
<td width="50%">
<input type="text" name="name" value="<%=name%>"></td></tr>
<td width="50%"><b>Last Name</b></td>
<td>
<input type="text" name="lsname" value="<%=lastName%>"><br/></td></tr>

<td width="50%"><b>Age </b></td>
<td>
<input type="text" name="age" value="<%=age%>"><br/></td>

</tr>
<tr><td><center>
<input type="submit" name="update" value="Update"></center></td></tr>

</tr>
</table>
</form>
</td>
</tr>
</table>
</center>
</body>
</html>

------------------------------

November 18, 2008 at 12:35 AM

Edit action code:

-----------------------------

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

<%
Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String password="amar123";

System.out.println( "uri : "+ request.getRequestURI());
int id = Integer.parseInt(request.getParameter("id"));
System.out.println("id:"+id);
String name = request.getParameter("name");
String lsname = request.getParameter("lsname");
String age = request.getParameter("age");

try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,password);
try{
Statement st = con.createStatement();
String sqlQuery ="update userinform set name='"+name+"',lsname='"+lsname+"',age='"+age+"' where id="+id;
int update = st.executeUpdate(sqlQuery);
con.close();
out.println("successfully update data from database!");

}
catch (SQLException ex){
System.out.println("SQL statement is not executed!");
}
}
catch (Exception e){
e.printStackTrace();
}

%>
<br>
<a href="showDataAction.jsp">Edit Page</a>

-----------------------------------

Visit for more information.

http://www.roseindia.net/jsp/user-search.shtml

Thanks.

Amardeep









Related Tutorials/Questions & Answers:
can u plz try this program - Java Beginners
can u plz try this program  Write a small record management application for a school. Tasks will be Add Record, Edit Record, Delete Record, List Records. Each Record contains: Name(max 100 char), Age, Notes(No Maximum Limit
Can u Look to the error plz - Java Beginners
Can u Look to the error plz  this is my code can u modify it plz and give me the result of it when u check it on eclipse or jcreator plz and i will be more thankfull if u do that :) , oh yeh one thing can you draw a flag
Advertisements
plz help me any one as fast as u can
plz help me any one as fast as u can  A thief Muthhooswamy planned... is given in an array. Write a program to find out the total number of jumps he will make to escape from the jail. Input Specifications Your program must read 4
can u plz explain the http request methods - JSP-Servlet
can u plz explain the http request methods  can u plz explain http... duplicate entries in the MySQL database we can follow one of these following approach... we can execute following query: Query CREATE TABLE backup_table AS SELECT
can u plz help out how to attach file directly & send to a particular mail id
can u plz help out how to attach file directly & send to a particular mail id  i am building a project online LEAVE MANAGEMENT SYSTEM to our coll mini project so if a faculty write all details abt leave & shd send to HOD
plz help me find a program
plz help me find a program  plz help..i want a source code in jsp for order processing
how can u reduce the size of textfield?
how can u reduce the size of textfield?  how can u reduce the size of textfield? thanks in advance   import javax.swing.*; public class ReduceTextField extends JFrame { public static void main(String
plz try to clear my doubt for shuffling multi-dimensional array
plz try to clear my doubt for shuffling multi-dimensional array  hi, if v r using Arrays.asList() means, it may shuffle the row wise list only... v...??? plz help me... thanks in advance   Hi Friend, Try the following code
Write a program that replaces a, e, i, o, u in Java2
Write a program that replaces a, e, i, o, u in Java2  Write a program that replaces a, e, i, o, u, with the letter z. (i.e. John Smith -> Jzhn Smzth. Also the program reverses the users name (i.e. John Smith -> htimS nhoJ
can u help me to get a calendar with color codes on days ???
can u help me to get a calendar with color codes on days ???  hi roseindia, Can you help me to get the code, I need a calendar with color codes.i,e....... NOTE:Its a calendar not a date-picker PLZ can you help me, its very urgent
plz explain me the output of program - Java Beginners
plz explain me the output of program  Hi friends, can u please explain me the output of below program with proper explanation of each and every line...;Hi Friend, Output of this program is: a=2 b=0 c=0 mul=27 volume=18
CAN U HELP ME TO CODE IN JSP FOR ONLINE VOTING SYSTEM
CAN U HELP ME TO CODE IN JSP FOR ONLINE VOTING SYSTEM  can u help me to code in jsp for online voting system
plz solve this program - Java Interview Questions
plz solve this program  write a program to out put this resault using two dimensional array this is an image of the reasult: http://www.4shared.com/file/154846107/dc2f1ac1/_2__Untitled-1.html so help me
plz anyone can solve my
plz anyone can solve my  creat an applet prog which accepts the details of 10 customers like name , address , city , ect. and display it   import java.awt.*; import javax.swing.*; import java.awt.event.*; import
swing program plz urgent sir - Java Beginners
swing program plz urgent sir   hi sir,i waan a jtable swings program table having column names "itemid","price".Initially table having single empty row.whenever we click the "enter" button automatically new row will be insert
Plz Provide correct program code for all questions.
Plz Provide correct program code for all questions.   Write a program... of n numbers? Develop a program that accepts the area of a square and will calculate its perimeter. Develop the program calculateCylinderVolume., which accepts
very urgent : Iam unable to code this program plz help me - RMI
very urgent : Iam unable to code this program plz help me  Write a Multi-user chat server and client.  Hi friend, Chat server... must be connected with the server after that your message can broadcast to each
how the answer is 13 can anyone explain plz
how the answer is 13 can anyone explain plz  public class that { public static void main(String arr[]) { int i=3; int j=1; while(i<4) { //j=i; i=i+j/2; } System.out.println(i
plz help me out with this problem...please write the program for me.thanxxxxx
plz help me out with this problem...please write the program for me.thanxxxxx  Write a program that will print out a hydro bill. The bill will be formatted as the example on the next page. The following information
plz help me out with this problem...please write the program for me.thanxxxxx
plz help me out with this problem...please write the program for me.thanxxxxx  Write a program that will print out a hydro bill. The bill will be formatted as the example on the next page. The following information
How Jdbc program can be run??
How Jdbc program can be run??  import java.sql.*; import java.util.*; class MyDbCode3 { public static void main(String [] args) { try...; System.out.println("Enter bookid:"); id=kb.nextInt(); try
ModuleNotFoundError: No module named 'u'
ModuleNotFoundError: No module named 'u'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'u... library. You can install u python with following command: pip install u
ModuleNotFoundError: No module named 'u'
ModuleNotFoundError: No module named 'u'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'u... library. You can install u python with following command: pip install u
this code gives addition of 2 numbers in j2me..but the code is not executing ..can u pls find out the error...??
this code gives addition of 2 numbers in j2me..but the code is not executing ..can u pls find out the error...??  import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class add1 extends MIDlet implements
Java try, catch, and finally
Java try, catch, and finally         The try, catch, and finally keywords are Java keywords that are used to handle the exception in a program.  The mechanism to handle
really need help on how to write this program plz some 1 help out. - Java Beginners
really need help on how to write this program plz some 1 help out.  i am confused here on what to write can some 1 help out here i dont quite understand how to code it so can some 1 help out. Part II Write, compile and execute
displaying List of records from database in a jsp using ajax, onclick it should display the results ?? its urgent can u help me
displaying List of records from database in a jsp using ajax, onclick it should display the results ?? its urgent can u help me   displaying List... ?? its urgent can u help me
Nested Try-Catch Blocks
Nested Try-Catch Blocks       In Java we can have nested try and catch blocks. It means that, a try statement can be inside the block of another try. If an inner try
plz give me program to this: Given a string and a number ‘n’, find the ‘n’th distinct repeating character.
plz give me program to this: Given a string and a number ?n?, find the ?n?th distinct repeating character.    Given a string and a number ?n?, find the ?n?th distinct repeating character. For example, Input: Abracadabra, 1
ModuleNotFoundError: No module named 'pexpect-u'
have to install padas library. You can install pexpect-u python with following...ModuleNotFoundError: No module named 'pexpect-u'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'u-cli'
ModuleNotFoundError: No module named 'u-cli'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'u-cli... padas library. You can install u-cli python with following command: pip
data science u of c
data science u of c  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science u of c Try to provide me good examples or tutorials links so that I can learn
u of m data science
u of m data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: u of m data science Try to provide me good examples or tutorials links so that I can learn
**Connectivity is not getting done in this program plz check it out wat is the problem with that Although i've made tables in MA-ACCESS**
**Connectivity is not getting done in this program plz check it out wat...) { int a = Integer.parseInt(id.getText()); a++; try...(id.getText()); a--; try
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers  how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
Try it Editor
Try it Editor  Hello sir...actually i want to add an html,css & js editor like in w3 school try it editor 1.5....can you tell me how i can add it..pllz plzzz rppy soon
Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times)
Can u print in turbo C  Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times
ModuleNotFoundError: No module named 'plz'
ModuleNotFoundError: No module named 'plz'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'plz... library. You can install plz python with following command: pip install
ModuleNotFoundError: No module named 'plz'
ModuleNotFoundError: No module named 'plz'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'plz... library. You can install plz python with following command: pip install
plz plz plz inform me as soon as possible
plz plz plz inform me as soon as possible  ``by using c programs how to type
Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times)
Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times)  Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print
ModuleNotFoundError: No module named 'thank_u_ostad'
environment you have to install padas library. You can install thank_u_ostad python...ModuleNotFoundError: No module named 'thank_u_ostad'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'u-msgpack-python'
python environment you have to install padas library. You can install u-msgpack...ModuleNotFoundError: No module named 'u-msgpack-python'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'flake8-no-u-prefixed-strings'
library. You can install flake8-no-u-prefixed-strings python with following...ModuleNotFoundError: No module named 'flake8-no-u-prefixed-strings'  Hi, My Python program is throwing following error: ModuleNotFoundError
Thank U - Java Beginners
Thank U  Thank U very Much Sir,Its Very Very Useful for Me. From SUSHANT
Plz Help
Plz Help  Hello Guys!! Plz. Help I need to write a program to display the astrological sign based on your birthday for example If we enter the date of birth in the following format from console--13/08/1990 it should give you
u of t data science certificate
that I can learn the topic "u of t data science certificate". Also...u of t data science certificate  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: u of t
ModuleNotFoundError: No module named 'try'
ModuleNotFoundError: No module named 'try'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'try... library. You can install try python with following command: pip install
try catch
try catch  why following code gives compile time error.please reply...=1;i<=3;i++) { System.out.println(i); try...); try { Thread.sleep(1000
Nested try
(String args[]) { try { int a = Integer.parseInt(args[0]); int b...[]) { try { nestedTry(args); } catch (ArithmeticException e...: java Demo 2 3, it will give output 0 , the try block of method is called which

Ads