Home Answers Viewqa JSP-Servlet Parent - child jsp communication

 
 


manjith
Parent - child jsp communication
3 Answer(s)      3 years and 11 months ago
Posted in : JSP-Servlet

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 Pages:
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
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
passing text value from pop up to parent page
passing text value from pop up to parent page  i want to pass value of a textbox of one pop up window to its parent page(html). that parent page contain a table. And i want to pass that text value to one cell in table of parent
remove parent element JavaScript
remove parent element JavaScript  How to remove parent element in JavaScript
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 Description
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
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
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
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
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 : Methods
servlet to applet communication
(servletConnection.getInputStream()); g.drawString("Applet Servlet Communication",50,50); String str
changing primary key of parent table
changing primary key of parent table  I want to change one primary key from a table where primary key is auto created? How can I do that? I have tried UPDATE person SET personid=3494 WHERE personid=8483; and i get the following
How do you call a constructor for a parent class?
How do you call a constructor for a parent class?  How do you call a constructor for a parent class
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
Java file get parent directory
Java file get parent directory In this section, you will learn how to get the parent directory of the file. Description of code: The package java.io.... which of String type. This method returns the parent directory of specified file
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
Forward Log Records to Its Parent
Forward Log Records to Its Parent   ... to its parent. You know that a logger sends both log records (messages declared before setting the log for it's parent and log messages after setting
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
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
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
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: 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-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
Change parent directory on ftp server
In this section you will learn how to change the parent directory on FTP server using java
how to set values from parent page to iframe in javascript
how to set values from parent page to iframe in javascript  how to set values from parent page to iframe in javascript pls reply me as possible as I am in great trouble
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
Outsourcing Communication Tips,Useful Cultural Tips in Offshore Outsourcing,Communication and Culture Tips
Communication and Culture Tips in Offshore Outsourcing Relationships... into difficulties due to communication problems. The trend is very prominent in both... communication arrangement? Or is it due to poor communication skills of the people
JSF validator Tag
to the nearest parent component. Typically all applications requires filling some... (in faces-config file and validator tag in jsp file ) should match.  Code...-id" is the alias name (this will be used in jsp file to access the actual
how to use iframe in jsp - JSP-Servlet
links which point to error. jsp an another jsp when i click the link a new page is opened.however i require to open it in the parent jsp help me please...how to use iframe in jsp  Hi, i am using a jsp page in whic records
RMI n JSP - RMI
RMI n JSP  Hi Friends, First of all let me appreciate ur promptness in delivering answers. Is it possible to make communication between RMI and JSP page ? Thanks
RMI n JSP - RMI
RMI n JSP  Hi Friends, First of all let me appreciate ur promptness in delivering answers. Is it possible to make communication between RMI and JSP page ? Thanks
Iframe conetent - JSP-Servlet
Iframe conetent  Hi! i am loading web page in iframe in jsp page. when i am clicking on the link of iframe links it is loading in parent window that means in same window. i want to open the iframe content in new page
Inter-Thread Communication
Inter-Thread Communication       Java provides a very efficient way through which multiple-threads...; This technique is known as Interthread communication which is implemented
Communication Tube - web-based messenger!
Communication Tube - web-based messenger!       CommunicationTube - It's a free web messenger chat client for the popular IM (instant messaging) networks: Windows Live Messenger (MSN
problem connect jsp and mysql - JSP-Servlet
problem connect jsp and mysql  hello, im getting an error while connecting jsp and mysql. I have downloaded the driver mysql-connector...: org.apache.jasper.JasperException: Exception in JSP: /jsptutorial/testsql.jsp:17 14
jsp usebean problem - Struts
jsp usebean problem   --Select... jsp... popupWindow=null; function parent_disable() { if(popupWindow
What are the features of web designing
as effective and most efficient tools of communication. The image... Every web page in the site looks like the parts of the parent site
JSP BASICS
Defines the extended parent class of the JSP generated servlet...JSP BASICS What is JSP ? JSP Stands for "Java Server Pages". Using... entire page through one program. Using JSP, you can built two parts separately
Array problem - JSP-Servlet
, the corresponding ID and name gets populated in the parent window.. It works fine for me

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.