Parent - child jsp communication

Parent - child jsp communication

View Answers

July 14, 2009 at 1:34 PM

Hi Friend,

Please visit the following links:

http://www.roseindia.net/jsp/popup-window-using-ajax-in-jsp.shtml
http://www.roseindia.net/jsp/pop-window.shtml

Hope that it will be helpful for you.
Thanks

July 14, 2009 at 4:36 PM

Hi..,

you can use query string to pass values..

like showpopup.jsp?kms=4500

hope will help you


Thanks
Sakthivel

July 16, 2009 at 3:38 PM

Hi Friend,

Try the following code:

1)user.jsp:
<%@ page import="java.sql.*" %>
<html>
<head>
<script language="javascript">
function editRecord(id){
window.open('http://localhost:8080/examples/jsp/edituser.jsp?id='+id,'mywindow','width=500, height=350,toolbar=no,resizable=yes,menubar=yes');

}
</script>
</head>
<body>

<br><br>
<table border="1">
<tr><th>Serial No</th><th>From City</th><th>To City</th><th>Distance</th><th></th></tr>
<%
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";;
String db = "test";
String driver = "com.mysql.jdbc.Driver";
String userName ="root";
String password="root";

int sumcount=0;
Statement st;
try{
Class.forName(driver).newInstance();
con = DriverManager.getConnection(url+db,userName,password);
String query = "select * from Person";
st = con.createStatement();
ResultSet rs = st.executeQuery(query);
%>

<%
while(rs.next()){
%>
<tr><td><%=rs.getString(1)%></td>
<td><%=rs.getString(2)%></td>
<td><%=rs.getString(3)%></td>
<td><%=rs.getString(4)%></td>
<td><input type="button" name="edit" value="Edit" style="background-color:#49743D;font-weight:bold;color:#ffffff;" onclick="editRecord(<%=rs.getString(1)%>);" ></td>
</tr>
<%
}
%>
<%
}
catch (Exception e) {
e.printStackTrace();
}
%>
</table>
</form>
</body>
</html>

2)edituser.jsp
<%@page language="java"%>
<%@page import="java.sql.*"%>
<form method="post" action="update.jsp">
<table border="1">
<tr><th>Serial No</th><th>From City</th><th>To City</th><th>Distance</th></tr>
<%
String id=request.getParameter("id");
int no=Integer.parseInt(id);

Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";;
String dbName = "test";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "root";

int sumcount=0;
Statement st;

try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
String query = "select * from Person where serialNo='"+no+"'";
st = conn.createStatement();
ResultSet rs = st.executeQuery(query);
while(rs.next()){
%>

<tr>
<td><input type="text" name="sNo" value="<%=rs.getString(1)%>"></td>
<td><input type="text" name="from" value="<%=rs.getString(2)%>"></td>
<td><input type="text" name="to" value="<%=rs.getString(3)%>"></td>
<td><input type="text" name="dis" value="<%=rs.getString(4)%>"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Update" style="background-color:#49743D;font-weight:bold;color:#ffffff;"></td>
</tr>
<%
}
}
catch(Exception e){}
%>
</table>
</form>
</form>

3)update.jsp
<%@page import="java.sql.*"%>
<% String no=request.getParameter("sNo");
String from=request.getParameter("from");
String to=request.getParameter("to");
String distance=request.getParameter("dis");
try{
Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root";, "root");

Statement st=null;
st=conn.createStatement();
st.executeUpdate("update Person set serialNo='"+no+"', fromCity='"+from+"',toCity='"+to+"',distance='"+distance+"' where serialNo='"+no+"'");
out.println("Data is updated successfully");
}
catch(Exception e){}
%>

Thanks









Related Tutorials/Questions & Answers:
Applet JSP communication - Applet
Applet JSP communication  Hi.. I've an application where i need to get the data from the applet to JSP... How can i do this..?? can anyone explain with a sample code
jsp applet communication - JSP-Servlet
jsp applet communication  Hi... We've an application where v need to create an object in the jsp and send that to an applet... For this v used in which we passed object as a parameter... v created a connection object in jsp
Advertisements
Communication Portal
Communication Portal       A communication interface desinged with Web 2.0 technology, mission is to help peolpe communicate easily over a comfortable web interface Read full
Communication Tube
Communication Tube       Communication Tube - web messenger chat client for the popular IM (instant messaging) networks: ICQ , MSN Messenger, Google Talk (GTalk) , IRC Read full
Interthread Communication
Inter-Thread Communication   ... communication among threads which reduces the CPU?s idle time i.e. A process where...; This technique is known as Interthread communication which is implemented by some
Communication Effectiveness in Outsourcing, Communication Techiques in Outsourcing
Communication Effectiveness in Outsourcing  Introduction A good part of the communication in outsourcing relationships is achieved... to communicate, the success of communication increases in the order of email, telephone
Inter Server Communication - Struts
Inter Server Communication   Hi In my project I am using Struts2.0 ,I have 2 server one is web-logic server and another is Tomcat server. In web... ,struts application is tomcat server. My problem is ,how I call my jsp page
digital communication system
digital communication system  A digital communication system capable of interconnecting, a large number of computers, terminals and other peripheral devices within a limited geographical area is called- a) LAN, B) WAN, C
Data over Voice Communication
Data over Voice Communication  I just Want to know that Data Over Voice communication is possible in India or Not, If not then Why. and If Yes then Why Please anyone give the answer
Inter Thread Communication
Inter Thread Communication  what is inter thread communication?   hi friend, Inter thread communication is a process of communication between two threads. In this process, a thread outside the critical section is tried
Jsp-Jsp Comminication - JSP-Servlet
Jsp-Jsp Comminication  Can we make jsp to jsp communication   Hi friend, Name Saved Next Page to view the session value.... http://www.roseindia.net/jsp/ Thanks
applet servlet communication - Applet
applet servlet communication  Can anybody tell me applet - servlet communication by creating a webproject in eclipse. I am creating a web...()); g.drawString("Applet Servlet Communication",50,50); String str = new String(); str
ModuleNotFoundError: No module named 'gaia-communication'
ModuleNotFoundError: No module named 'gaia-communication'  Hi, My... named 'gaia-communication' How to remove the ModuleNotFoundError: No module named 'gaia-communication' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'luxx_communication'
ModuleNotFoundError: No module named 'luxx_communication'  Hi, My... named 'luxx_communication' How to remove the ModuleNotFoundError: No module named 'luxx_communication' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'pumpwood-communication'
ModuleNotFoundError: No module named 'pumpwood-communication'  Hi...: No module named 'pumpwood-communication' How to remove the ModuleNotFoundError: No module named 'pumpwood-communication' error? Thanks   Hi
ModuleNotFoundError: No module named 'pumpwood-communication'
ModuleNotFoundError: No module named 'pumpwood-communication'  Hi...: No module named 'pumpwood-communication' How to remove the ModuleNotFoundError: No module named 'pumpwood-communication' error? Thanks   Hi
ModuleNotFoundError: No module named 'gaia-communication'
ModuleNotFoundError: No module named 'gaia-communication'  Hi, My... named 'gaia-communication' How to remove the ModuleNotFoundError: No module named 'gaia-communication' error? Thanks   Hi, In your
Interthread Communication in Java
Interthread Communication in Java As you know about producer-consumer problem... wasting of cycle or polling, interthread communication is a good way.  Given below some function helpful in interthread communication :ADS_TO_REPLACE_1
Version of com.michaelpardo>materialdesignicons-communication dependency
List of Version of com.michaelpardo>materialdesignicons-communication dependency
servlet to applet communication
(servletConnection.getInputStream()); g.drawString("Applet Servlet Communication",50,50); String str
What is the general flow of Hibernate communication with RDBMS?
What is the general flow of Hibernate communication with RDBMS?  Hi, What is the general flow of Hibernate communication with RDBMS? thanks
Interthread communication
Interthread communication   ... communication among threads which reduces the CPU?s idle time i.e. A process where...; This technique is known as Interthread communication which is implemented by some
serial port communication using bluetooth in j2me
serial port communication using bluetooth in j2me   how to make serial port communication using bluetooth in j2me ? what r prerequisites
serial port communication using bluetooth in j2me
serial port communication using bluetooth in j2me   how to make serial port communication using bluetooth in j2me ? what r prerequisites
Java Serial Communication - IDE Questions
Java Serial Communication  Does Netbeans support serial port communication for windows??? because netbeans doesnt support javax.comm package . I tried my program with notepad for rxtx. It worked properly & same with netbeans
ModuleNotFoundError: No module named 'computer_communication_framework'
ModuleNotFoundError: No module named 'computer_communication_framework' ...: ModuleNotFoundError: No module named 'computer_communication_framework' How to remove the ModuleNotFoundError: No module named 'computer_communication_framework'
ModuleNotFoundError: No module named 'odoo10-addon-l10n-it-invoices-data-communication'
-communication'  Hi, My Python program is throwing following error...-communication' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-l10n-it-invoices-data-communication' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo10-addon-pos-backend-communication'
ModuleNotFoundError: No module named 'odoo10-addon-pos-backend-communication...: ModuleNotFoundError: No module named 'odoo10-addon-pos-backend-communication' How...-communication' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'odoo10-addon-pos-backend-communication'
ModuleNotFoundError: No module named 'odoo10-addon-pos-backend-communication...: ModuleNotFoundError: No module named 'odoo10-addon-pos-backend-communication' How...-communication' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'odoo10-addon-pos-backend-communication'
ModuleNotFoundError: No module named 'odoo10-addon-pos-backend-communication...: ModuleNotFoundError: No module named 'odoo10-addon-pos-backend-communication' How...-communication' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'odoo12-addon-l10n-it-invoices-data-communication'
-communication'  Hi, My Python program is throwing following error...-communication' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-l10n-it-invoices-data-communication' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo12-addon-l10n-it-invoices-data-communication'
-communication'  Hi, My Python program is throwing following error...-communication' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-l10n-it-invoices-data-communication' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo12-addon-l10n-it-invoices-data-communication'
-communication'  Hi, My Python program is throwing following error...-communication' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-l10n-it-invoices-data-communication' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo12-addon-l10n-it-vat-statement-communication'
-communication'  Hi, My Python program is throwing following error...-communication' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-l10n-it-vat-statement-communication' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo12-addon-l10n-it-vat-statement-communication'
-communication'  Hi, My Python program is throwing following error...-communication' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-l10n-it-vat-statement-communication' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo8-addon-l10n-it-invoices-data-communication'
-communication'  Hi, My Python program is throwing following error...-communication' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-l10n-it-invoices-data-communication' error? Thanks   Hi
ModuleNotFoundError: No module named 'computer_communication_framework'
ModuleNotFoundError: No module named 'computer_communication_framework' ...: ModuleNotFoundError: No module named 'computer_communication_framework' How to remove the ModuleNotFoundError: No module named 'computer_communication_framework'
Version of com.buabook>java-kdb-communication dependency
List of Version of com.buabook>java-kdb-communication dependency
Need of Communication Management
Communication management is the systematic process by which any organization planned, implement, monitor or revision the all channels of communication for better output. It is the wide use of communication technology within
Communication Website Development
Communication Website Development We provide high quality Communication... team will help you in developing websites for Communication industry. We... for communication industry. A website is the virtual representation of a company
Maven Dependency materialdesignicons-communication >> 1.0.1
You should include the dependency code given in this page to add Maven Dependency of com.michaelpardo >> materialdesignicons-communication version1.0.1 in your project
Maven Dependency materialdesignicons-communication >> 1.0.2
You should include the dependency code given in this page to add Maven Dependency of com.michaelpardo >> materialdesignicons-communication version1.0.2 in your project
Communication: Marketing tools
Communication has become an inseparable part of modern life and the same is true for the survival of any business organization where communication... be a guarantee for its success if there is a gap of communication among its other
jsp & mysql - JSP-Servlet
jsp & mysql  can anybody tell me hoe to overcome from following error i am facing this problem...plz help me... org.apache.jasper.JasperException: Communication failure during handshake. Is there a server running on localhost
jsp
jsp  how jsp translated into servlets
JSP
JSP  How to run jsp program in eclipse
jsp
jsp  how to create jsp page
Jsp
Jsp  Can I implement interface in jsp
JSP
what is JSP forward tag for  what is JSP forward tag for   It forwards the current request to another JSP page. Below is the syntax for the same:- <jsp:forward page="...url..." /> We can also forward parameter
jsp
jsp  how to include two jsp page

Ads