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



Home Answers Viewqa JSP-Servlet Parent - child jsp communication

Have Programming Question? Ask it here!
 
 
 


manjith
Parent - child jsp communication
3 Answer(s)      5 years and a month ago
Posted in : JSP-Servlet



Advertisement
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
remove parent element JavaScript
remove parent element JavaScript  How to remove parent element in JavaScript
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
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
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 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
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
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
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
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
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
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
reload parent window - WebSevices
reload parent window  Hi, Here I have a code for close child window and reload parent window. window.opener.location.href="http://www.mysite.net/example.php"; self.close(); Its working properly when User enters
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
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 to include two jsp page
jsp
jsp  how to create jsp page
jsp
jsp  how jsp translated into servlets
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  Can I implement interface in jsp
JSP
JSP  How to run jsp program in eclipse
jsp
jsp  write a code for jsp file generator to generate a jsp page automatically taking html page as input
jsp
jsp  how to create a table in oracle using jsp and the table name is entered in text feild of jsp page
JSP
JSP  Hi, What is JSP? What is the use of JSP? Thanks   Hi, JSP Stands for Java Server Pages. It is Java technology for developing web applications. JSP is very easy to learn and it allows the developers to use Java
jsp
jsp   what is the basic necessities reguired for running jsp using JDBC bridge?? and how to write a jsp code to access the detail present in microsoft access pls send link regarding above
Advertisements
 

 

 

DMCA.com