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



Home Answers Viewqa Development-process JSP Client Application
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


uma
JSP Client Application
5 Answer(s)      6 years and 6 months ago
Posted in : Development process


JSP client application in Java - Can anyone give an example?


Advertisement
View Answers

April 19, 2008 at 8:31 PM


Hi friend,

This is form code.

<html>
<head>
<title>Untitled Page</title>

</head>

<body>

<table id="t1" border="1" width="50%" cellspacing="0" cellpadding="0" bgcolor="#F2FFF5">
<tr>
<td width="100%">
<form method="POST" action="adding-Action.jsp">

<h1>Row add and Delete Table</h1>
<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="50%"><b>Student Id:</b></td>
<td width="50%"><input type="text" name="stuid" size="5"></td>
</tr>
<tr>
<td width="50%"><b>Student Name:</b></td>
<td width="50%"><input type="text" name="stuname" size="20"></td>
</tr>
<tr>
<td width="50%"><b>Class:</b></td>
<td width="50%"><input type="text" name="room" size="20"></td>
</tr>
<tr>
<td width="50%"><b>Address:</b></td>
<td width="50%"><input type="text" name="address" size="50"></td>
</tr>
<tr>
<td width="50%"><b>Father Name:</b></td>
<td width="50%"><input type="text" name="faname" size="20"></td>
</tr>
<tr>
<td width="50%"><b>City:</b></td>
<td width="50%"><input type="text" name="city" size="20"></td>
</tr>
</table>
<p><input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset">

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

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



April 19, 2008 at 8:32 PM


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

<%

Connection con = null;
String url = "jdbc:mysql://localhost:3306/";;
String db = "register";
String driver = "com.mysql.jdbc.Driver";
java.util.Date date;
String s=null;
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,"root","root");
try{
Statement st = con.createStatement();
String stuid=request.getParameter("stuid");
String stuname=request.getParameter("stuname");
String room=request.getParameter("room");
String address=request.getParameter("address");
String faname = request.getParameter("faname");
String city = request.getParameter("city");

int val = st.executeUpdate("insert student_detail values('"+stuid+"','"+stuname+"','"+room+"','"+address+"','"+faname+"','"+city+"')");

con.close();
out.println("<b>Successfully insert data</b><br/>");
out.println("<br/><a href=studenet-retrive-Action.jsp><b>Retrive Data From Database</b></a>");
}
catch (SQLException ex){
System.out.println("SQL statement is not executed!");
}
}
catch (Exception e){
e.printStackTrace();
}

%>
-----------------------------


April 19, 2008 at 8:34 PM


<%@ page language="java" import="java.sql.*,java.util.*,java.text.*" %>
<html>
<title>Retrive value from database</title>
<head>
<script type="text/javascript">
function addRowToTable(){
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);

// left cell
var cellLeft = row.insertCell(0);
var textNode = document.createTextNode(iteration);
textNode.onkeypress = keyPressTest;
cellLeft.appendChild(textNode);

// right cell
var cellRight = row.insertCell(1);
var el = document.createElement('input');
el.type = 'text';
el.name = 'txtRow' + iteration;
el.id = 'txtRow' + iteration;
el.size = 30;

el.onkeypress = keyPressTest;
cellRight.appendChild(el);

var cellRight = row.insertCell(2);
var sel = document.createElement('input');
sel.type = 'text';
sel.name = 'txtRow' + iteration;
sel.id = 'txtRow' + iteration;
sel.size = 30;

sel.onkeypress = keyPressTest;
cellRight.appendChild(sel);

var cellRight = row.insertCell(3);
var sell = document.createElement('input');
sell.type = 'text';
sell.name = 'txtRow' + iteration;
sell.id = 'txtRow' + iteration;
sell.size = 30;

sell.onkeypress = keyPressTest;
cellRight.appendChild(sell);

}
function keyPressTest(e, obj){
var validateChkb = document.getElementById('chkValidateOnKeyPress');
if (validateChkb.checked){
var displayObj = document.getElementById('spanOutput');
var key;
if(window.event){
key = window.event.keyCode;
}
else if(e.which){
key = e.which;
}
var objId;
if (obj != null){
objId = obj.id;
}
else{
objId = this.id;
}
displayObj.innerHTML = objId + ' : ' + String.fromCharCode(key);
}
}
function removeRowFromTable(){
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
if(lastRow > 2) tbl.deleteRow(lastRow - 1);
}
function validateRow(frm){
var chkb = document.getElementById('chkValidate');
if(chkb.checked){
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length - 1;
var i;
for (i=1; i<=lastRow; i++) {
var aRow = document.getElementById('txtRow' + i);
if (aRow.value.length <= 0) {
alert('Row ' + i + ' is empty');
return;
}
}
}
openInNewWindow(frm);
}

</script>
</head>



April 19, 2008 at 8:34 PM


<body>
<h2><font color="#CC3366">Retrive data from database</font></h2>
<table border="0" width="50%" cellspacing="0" cellpadding="0">
<tr>
<td width="50%">
<form method="POST">
<table border="1" width="100%" cellspacing="0" cellpadding="0" bgcolor="#D9FFFF">
<tr>
<td width="50%" valign="right"><b>Student Id</b></td>
<td width="50%" valign="right"><b>Student Name</b></td>
<td width="50%" valign="right"><b>Class</b></td>
<td width="50%" valign="right"><b>Address</b></td>
<td width="50%" valign="right"><b>Father Name</b></td>
<td width="50%" valign="right"><b>City</b></td>
<td width="50%" valign="right"><b>Delete</b></td>
<td width="50%" valign="right"><b>Addrow</b></td>
<td width="50%" valign="right"><b>Removes</b></td>
<%
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";;
String db = "register";
String driver = "com.mysql.jdbc.Driver";
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,"root","root");
try{
Statement st = con.createStatement();
String query = "SELECT * FROM student_detail";
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
%>
</tr>
<tr>
<td width="50%" valign="right"><%out.println(rs.getString(1));%></td>
<td width="50%" valign="right"><%out.println(rs.getString(2));%></td>
<td width="50%" valign="right"><%out.println(rs.getString(3));%></td>
<td width="50%" valign="right"><%out.println(rs.getString(4));%></td>
<td width="50%" valign="right"><%out.println(rs.getString(5));%></td>
<td width="50%" valign="right"><%out.println(rs.getString(6));%></td>

<td>

<a href="studene-record-DeleteAction.jsp?id=<%=rs.getInt("stuid")%>"><input type="checkbox"></a>
</td>
<td><input type="button" value="Add" onclick="addRowToTable();" /></td>
<td><input type="button" value="Remove" onclick="removeRowFromTable();" /></td>
</tr>
<%}
out.println("<br/><a href=rowadd-and-delete.jsp><b>Home</b></a>");
rs.close();
con.close();

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

<table border="1" id="tblSample" cellspacing="0" cellpadding="0">
<tr>
<td width="25">1</td>
<td><input type="text" name="txtRow1" id="txtRow1" size="30" onkeypress="keyPressTest(event, this);" /></td>
<td>
&nbsp
</td>
</tr>
</table>

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


April 19, 2008 at 8:35 PM


This is delete code.

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

<%
String strId =request.getParameter("id");
int id = Integer.parseInt(strId);
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";;
String db = "register";
String driver = "com.mysql.jdbc.Driver";
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,"root","root");
try{
Statement st = con.createStatement();
String username=request.getParameter("stuname");
String room=request.getParameter("room");
String address=request.getParameter("address");
String faname=request.getParameter("faname");
String city=request.getParameter("city");

int in = st.executeUpdate("DELETE FROM student_detail where stuid ="+id);
con.close();
out.println("successfully updated");
}
catch (SQLException ex){
System.out.println("SQL statement is not executed!");
}
}
catch (Exception e){
e.printStackTrace();
}
%>


Related Tutorials/Questions & Answers:
Java Client Application
Java Client Application  Java Client Application
Java Client Application example
Java Client Application example  Java Client Application example
Advertisements
Java HTML Client Application
Java HTML Client Application  Java HTML Client Application
multi client mobile chat application
multi client mobile chat application  plz help me for creating wap based mobile chat application in neatbean. or simply multi client mobile chat application. its urgently thanx
multi client mobile chat application
mobile chat application  plz help me for creating wap based mobile chat application in neatbean. or simply multi client mobile chat application
multi client mobile chat application
chat application for mobile  plz help me for creating wap based mobile chat application in neatbean. or simply multi client mobile chat application. its urgently thanx
ssl client - JSP-Servlet
ssl client  How do you write SSL Client? Take example of SSL Socket Client
JSP to client side - JSP-Servlet
JSP to client side  Hi I have a JSP(graph.jsp) page which calls a servlet and get the output. The output is a JSON object. I want to use the same to plot a graph in flotr. How can I use the same
jsp application
jsp application  write a jsp application that will receive an integer from the client , check if the integer is even or odd and send the result to the client
Multicast under UDP(client server application)
Multicast under UDP(client server application)   UDP is used... in the following) and RMulticastClient (called client in the following) in Java... by a client, the content of the message has to be displayed. In addition the client
Client Side Application
Client Side Application       For creating the Client side application firstly... side application follows these steps : In the client sides firstly creates
File download from server to client machine - JSP-Servlet
File download from server to client machine  hi, I want to save a pdf file to my client machine from a button provoded in a jsp page.The file...//Myreport.pdf); i want to provide a way to client to save the report in above
Take print out from printer at client machienusing jsp - JSP-Servlet
Take print out from printer at client machienusing jsp  Sir/Mam I want do is to take out print out of my report which will be created from the Mysql database with out displaying him/her the results or report from the printer
JSP Application Object
JSP Application Object  JSP Application Object?   Application Object is used to share the data with all application pages. Thus, all users.... The Application object is accessed by any JSP present in the application. The class
Web application - JSP-Servlet
Web application   Helo can you please help me in knowing how to use jsp/servlets which allows users to post question in a forum so that other users can also view the question and respond to it.For instance your application here
Client Side validation in Struts 2 application
Client Side validation in Struts 2 application   ... for generating the client side java script.   Developing JSP pages Here.../showLoginClientSideValidation.action">Login Application (Client Side Validation)</a></li>
Thin client
Thin client  What is a thin client?   A thin client is a lightweight interface to the application that does not have such operations like query databases, execute complex business rules, or connect to legacy
getting the excel path throuh web browser given from client(i.e thruogh .jsp)
getting the excel path throuh web browser given from client(i.e thruogh .jsp)  1)when client uploads the excel sheet through a .jsp page, 2)get... in a jsp page i.e response to client through jsp please provide the code in spring
To publish jsp web application in intranet
To publish jsp web application in intranet  I am making web application in jsp with netbean. I want to publish this web application in LAN.... So please suggest some steps to publish jsp application. Your suggestion
how to create chat application in jsp?
how to create chat application in jsp?  i am developing online web portal using jsp, i need to communicate with admin, so i need integrate with the chat applicaion through the webportal
how to create chat application in jsp?
Creating Chat application in JSP  Creating Chat application in JSP i am developing online web portal using jsp, i need to communicate with admin, so i need integrate with the chat applicaion through the webportal
Add a jsp file to java application
Add a jsp file to java application  How to add a JSP file to java application?   <html> <head> <title>Include another... a file,having any application,code or any content..</h2><br/> <
RMI Client And RMI Server Implementation
application provides the mechanism by which the server and the client communicate... RMI Client And RMI Server Implementation       Introduction The RMI application
run exe on remote client
run exe on remote client  I am making a client server application using netbins 6.1 , Jsp servlet, Mysql5.1... I want to run an batch file or exe... copied files fromserver to client using my application but i cant run it on remote
who is client
who is client   tell me who is client is management
Client Interview
Client Interview  Hi, I am kumar i am having client round in polaries client is a BANK. how to face client interview. what are the expected questions from CITI
application using AJAX and JQuery and also use JSP
application using AJAX and JQuery and also use JSP   i need create an application using AJAX and JQuery and also use JSP
Features and Limitations of the Application
the client application on client side, enters the login name and hits the login... arraylist to every client. Limitations of the application are as follows... but the message is shown to every client. Means this application is unable to provide
Client Side and Server Side coding
Client Side and Server Side coding       The combo of client side and server side coding means the need of both scripts in an application. Without the mutual support
JSP implicit object "application"
JSP IMPLICIT OBJECT application In this section, we will discuss about JSP... in an application. It means the "application" object is accessed by any JSP...) : The method log of Application object is used to write a text string to the JSP
Simple Bank Application in JSP
Simple Bank Application in JSP   ... application in jsp . In this application user can Update the User Profile, Cash... transaction report  for particular time period. We run this Bank Application
Advertisements
 

 

 

DMCA.com