JSP to Applet communication

C

circuit_breaker

<%@ page import="java.sql.*" %>
<html>
<head>
<title>Tables in cookbook Database</title>
</head>
Hi,

From the following JSP code, I'd like to send the "category_name"
fields to an applet which will display the information using labels,
textboxes and so on... How do I establish the connection?

Thanks
--------------------------------
<body bgcolor="white">
<p>Inventory Database:</p>
<%
Connection conn = null;
String url = "jdbc:mysql://localhost/Inventory";
String user = "inv_user";
String password = "mypassword";
Class.forName ("com.mysql.jdbc.Driver").newInstance ( );
conn = DriverManager.getConnection (url, user, password);
Statement s = conn.createStatement ( );
s.executeQuery ("SELECT * FROM categories");
ResultSet rs = s.getResultSet ( );
while (rs.next ( ))
out.println (rs.getString("category_name" ) + "<br />");
rs.close ( );
s.close ( );
conn.close ( );
%>
</body>
</html>
 
A

Andrew Thompson

From the following JSP code, I'd like to send the "category_name"
fields to an applet which will display the information using labels,
textboxes and so on... How do I establish the connection?

applet <param> tag..
 
J

John C. Bollinger

circuit_breaker said:
<%@ page import="java.sql.*" %>
<html>
<head>
<title>Tables in cookbook Database</title>
</head>
Hi,

From the following JSP code, I'd like to send the "category_name"
fields to an applet which will display the information using labels,
textboxes and so on... How do I establish the connection?

From the applet to the JSP, if you use an actual "connection" at all.
This assumes the applet to be loaded by a different page. You can then
open a URLConnection to the JSP you describe below, and receive from it
the XML (or however else) formatted data to display.

If you want the applet to be presented by the same page in which the
lookup is performed then pass the relevant data in applet parameters, as
Andrew Thompson recommended. In that case the JSP cannot connect to the
applet because by the time the applet loads and starts (on the client)
the JSP has finished processing the request.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top