JSP to Applet Communication
Hello Java Guys,
We know how to communicate applet and servelt.But i have no idea on how to communicate JSP to applet.If anybody have any idea please let me know.Thanks in advance..
with cheers
Basha
HI,
When u use applet-servlet communication, servlet (which u've written in out.println()) writes the content in the streams,it get backs to the urlconnection.getOUtputStream(),u get only what written in out.println().
when u using applet-jsp communication, servletengine converts jsp-servlet,servlet writes the total content (which present in jsp page) in the streams.u get all the content including ur html tags.
Similar Messages
-
Simple JSP to applet communication query
Newish to java web services (using Tomcat as container & JWSDP1_0_01)
Developing a project using applets in JSPs. Am attempting to link the two up using HTTP tunnelling and/or object serialisation. I am able to prepare data for the ObjectOutputStream. I cannot get the data to display in the JSP once it has been sent and 'received' by ObjectInputStream. As a check i am able to read the JSP's HTML code back in to the applet but none of the sent data. Do i need configure a web xml file for this to work or is it my coding ?the penny has dropped.
Binary data can't be read by JSP.
Cheers,
jaymahinti. -
Get dynamic values in Jsp fom Applet
Hi,
Mine is not a unique question, its been asked many times on the same forum but still I havent got any satisfactory answer so I am putting this again.
I have one applet, it is been loaded from jsp. Applet uses double buffering and its values are changing constantly.
Now my question arises here, In my jsp i have one button on the click of that button I am calling some other jsp passing some of jsp values in URL. I also want to pass one of the value of applet to jsp so it can pass to next jsp or to do something that next jsp automatically gets the new value.
I thought for Applet-servlet communication but my concerns are,as my applet is being refreshed continuously(around every 1 sec) and the value which i have to pass is changing every second and I dont know when user will click on the button of jsp so to pass that value of applet i have to do applet-servlet communication every second and that does not suit me as it consumes lot of time.
Can you suggest me any other solution so I can send value through jsp whenever button is clicked.
Thanks
Taral ShahHI Senthil Babu
Thanks for your reply.
But applet is very important for my application as i am showing some graphical representation on it. So I have to use applet. Now you told that i have to make temporary files on client's macvhine. You mean to say each time I have to store that value on client's pc through File I/O.
Is that? but that is also problematic 'cause it consimes much time and my application deals in milli seconds.
Pl. guide me considering that time is much important for my application so solution should not consume much time.
Thanks again,
Taral Shah -
Asp-applet communication(URGENT!!)
hi,
i am facing a problem on asp-applet communication. i would like to ask how to pass applet parameters to asp page?my code below doesnt seem to work..
smsClient.java
public class smsClient {
private JOptionPane jOptionPanel = new JOptionPane();
private dialog dd;
String str;
public void executeSend(String smsno, String smsMessage,String user_id){
String qrysmsno=smsno;
String qrysmsMessage=smsMessage;
String qryUserId=user_id;
try{
String qry=URLEncoder.encode("smsno")+ "=" + URLEncoder.encode(qrysmsno) + "&";
qry= qry + URLEncoder.encode("smsMessage")+ "=" + URLEncoder.encode(qrysmsMessage);
//qry= qry + URLEncoder.encode("user_id")+ "=" + URLEncoder.encode(qryUserId);
URL url=new URL("http://172.20.34.116:8081/3dcommunity/sendsms.asp?"+qry);
dialog dd=new dialog();
//dd.showDialog(qry, "Alert!", JOptionPane.WARNING_MESSAGE);
URLConnection uc = url.openConnection();
uc.setDoOutput(true);
uc.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
PrintWriter pw = new PrintWriter(uc.getOutputStream());
pw.println(str);
pw.close();
BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream()));
String res = in.readLine();
dd.showDialog(res, "Alert!", JOptionPane.WARNING_MESSAGE);
in.close();
/*HttpURLConnection http = (HttpURLConnection)url.openConnection();
http.setRequestMethod("GET");
InputStream iStrm = null;
if (http.getResponseCode() == HttpURLConnection.HTTP_OK) {
iStrm = http.getInputStream();
int length = (int) http.getContentLength();
if (length > 0) {
byte servletData[] = new byte[length];
iStrm.read(servletData);
String resultString = new String(servletData);
dd.showDialog(res, "Alert!", JOptionPane.WARNING_MESSAGE);
iStrm.close();*/
catch(MalformedURLException e){
System.err.println(e);
dd.showDialog("MalformedURLException", "Alert!", JOptionPane.ERROR_MESSAGE);
catch(IOException e){
System.err.println(e);
dd.showDialog("IOException", "Alert!", JOptionPane.ERROR_MESSAGE);
sendsms.asp
<%
set mySMS = Server.CreateObject("SCSMS.SMS")
mySMS.Port = "COM3"
%>
<%
mfg = mySMS.Manufacturer
mdl = mySMS.Model
if mySMS.Error then
response.write mySMS.ErrorMsg
else
response.write "Manufacturer : " & mfg & "<br>"
response.write "Model : " & mdl & "<br><br>"
end if
smsno=request.queryString("smsno")
smsMessage=request.queryString("smsMessage")
mySMS.sendsms smsno, smsMessage
if mySMS.Error <> 0 then
'response.write "Failed" & mySMS.ErrorMsg
else
response.write "Success"
end if
%>use the following class for applet to any web site connection (it can be asp, jsp, cgi etc)
package com.oreilly.servlet;
import java.io.*;
import java.net.*;
import java.util.*;
* A class to simplify HTTP applet-server communication. It abstracts
* the communication into messages, which can be either GET or POST.
* <p>
* It can be used like this:
* <blockquote><pre>
* URL url = new URL(getCodeBase(), "/servlet/ServletName");
* HttpMessage msg = new HttpMessage(url);
* // Parameters may optionally be set using java.util.Properties
* Properties props = new Properties();
* props.put("name", "value");
* // Headers, cookies, and authorization may be set as well
* msg.setHeader("Accept", "image/png"); // optional
* msg.setCookie("JSESSIONID", "9585155923883872"); // optional
* msg.setAuthorization("guest", "try2gueSS"); // optional
* InputStream in = msg.sendGetMessage(props);
* </pre></blockquote>
* <p>
* This class is loosely modeled after the ServletMessage class written
* by Rod McChesney of JavaSoft.
* @author <b>Jason Hunter</b>, Copyright © 1998
* @version 1.3, 2000/10/24, fixed headers NPE bug
* @version 1.2, 2000/10/15, changed uploaded object MIME type to
* application/x-java-serialized-object
* @version 1.1, 2000/06/11, added ability to set headers, cookies,
and authorization
* @version 1.0, 1998/09/18
public class HttpMessage {
URL servlet = null;
Hashtable headers = null;
* Constructs a new HttpMessage that can be used to communicate with the
* servlet at the specified URL.
* @param servlet the server resource (typically a servlet) with which
* to communicate
public HttpMessage(URL servlet) {
this.servlet = servlet;
* Performs a GET request to the servlet, with no query string.
* @return an InputStream to read the response
* @exception IOException if an I/O error occurs
public InputStream sendGetMessage() throws IOException {
return sendGetMessage(null);
* Performs a GET request to the servlet, building
* a query string from the supplied properties list.
* @param args the properties list from which to build a query string
* @return an InputStream to read the response
* @exception IOException if an I/O error occurs
public InputStream sendGetMessage(Properties args) throws IOException {
String argString = ""; // default
if (args != null) {
argString = "?" + toEncodedString(args);
URL url = new URL(servlet.toExternalForm() + argString);
// Turn off caching
URLConnection con = url.openConnection();
con.setUseCaches(false);
// Send headers
sendHeaders(con);
return con.getInputStream();
* Performs a POST request to the servlet, with no query string.
* @return an InputStream to read the response
* @exception IOException if an I/O error occurs
public InputStream sendPostMessage() throws IOException {
return sendPostMessage(null);
* Performs a POST request to the servlet, building
* post data from the supplied properties list.
* @param args the properties list from which to build the post data
* @return an InputStream to read the response
* @exception IOException if an I/O error occurs
public InputStream sendPostMessage(Properties args) throws IOException {
String argString = ""; // default
if (args != null) {
argString = toEncodedString(args); // notice no "?"
URLConnection con = servlet.openConnection();
// Prepare for both input and output
con.setDoInput(true);
con.setDoOutput(true);
// Turn off caching
con.setUseCaches(false);
// Work around a Netscape bug
con.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
// Send headers
sendHeaders(con);
// Write the arguments as post data
DataOutputStream out = new DataOutputStream(con.getOutputStream());
out.writeBytes(argString);
out.flush();
out.close();
return con.getInputStream();
* Performs a POST request to the servlet, uploading a serialized object.
* <p>
* The servlet can receive the object in its <tt>doPost()</tt> method
* like this:
* <pre>
* ObjectInputStream objin =
* new ObjectInputStream(req.getInputStream());
* Object obj = objin.readObject();
* </pre>
* The type of the uploaded object can be determined through introspection.
* @param obj the serializable object to upload
* @return an InputStream to read the response
* @exception IOException if an I/O error occurs
public InputStream sendPostMessage(Serializable obj) throws IOException {
URLConnection con = servlet.openConnection();
// Prepare for both input and output
con.setDoInput(true);
con.setDoOutput(true);
// Turn off caching
con.setUseCaches(false);
// Set the content type to be application/x-java-serialized-object
con.setRequestProperty("Content-Type",
"application/x-java-serialized-object");
// Send headers
sendHeaders(con);
// Write the serialized object as post data
ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream());
out.writeObject(obj);
out.flush();
out.close();
return con.getInputStream();
* Sets a request header with the given name and value. The header
* persists across multiple requests. The caller is responsible for
* ensuring there are no illegal characters in the name and value.
* @param name the header name
* @param value the header value
public void setHeader(String name, String value) {
if (headers == null) {
headers = new Hashtable();
headers.put(name, value);
// Send the contents of the headers hashtable to the server
private void sendHeaders(URLConnection con) {
if (headers != null) {
Enumeration enum = headers.keys();
while (enum.hasMoreElements()) {
String name = (String) enum.nextElement();
String value = (String) headers.get(name);
con.setRequestProperty(name, value);
* Sets a request cookie with the given name and value. The cookie
* persists across multiple requests. The caller is responsible for
* ensuring there are no illegal characters in the name and value.
* @param name the header name
* @param value the header value
public void setCookie(String name, String value) {
if (headers == null) {
headers = new Hashtable();
String existingCookies = (String) headers.get("Cookie");
if (existingCookies == null) {
setHeader("Cookie", name + "=" + value);
else {
setHeader("Cookie", existingCookies + "; " + name + "=" + value);
* Sets the authorization information for the request (using BASIC
* authentication via the HTTP Authorization header). The authorization
* persists across multiple requests.
* @param name the user name
* @param name the user password
public void setAuthorization(String name, String password) {
String authorization = Base64Encoder.encode(name + ":" + password);
setHeader("Authorization", "Basic " + authorization);
* Converts a properties list to a URL-encoded query string
private String toEncodedString(Properties args) {
StringBuffer buf = new StringBuffer();
Enumeration names = args.propertyNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
String value = args.getProperty(name);
buf.append(URLEncoder.encode(name) + "=" + URLEncoder.encode(value));
if (names.hasMoreElements()) buf.append("&");
return buf.toString();
} -
How to include applet in jsp if applet.class file in another folder
hi,
i'm getting problem when my applet.class file is not with its appropriate jsp file. i'm using jsp :plugin tag.it work when jsp file n apllet.class file at same location.
in short my jsp file is at location /webapps/jsp-examples/myproject/includeDemo.jsp
n applet i want in a WEB-INF folder.
Plz help me to solve this..
or give me other way that an applet can be loaded in jsp page n applet should be in WEB-INF file..
Help me for thishttp://forum.java.sun.com/thread.jspa?threadID=5148764&messageID=9556205
-
How To Pass the value from JSP to Applet
plz reply how can we pass the value from the JSP to Applet ...the applet is embedded in JSP page....
Hi,
<applet codebase = "."
archive = foo.jar"
code = "com.bar"
name = "bar"
id = "bar"
width = "<%=Request["width"] %>"
HEIGHT = "<%=Request["appHeight"] %>"
hspace = "0"
vspace = "0"
align = "middle"
alt = "Applet is Loading..."
>
<param name="LANGUAGE" value="<%=Request["lan"] %>">
<param name="LOGOUT_USER_URL" value="EndSession.asp">
<param name="DATA_READ_INTERVAL" value="10000">
<param name="REFRESH_INTERVAL" value="5000">
<param name="DEFAULT_FONT" value="Arial">
</applet>
pass values @ ur html or jsp page to Applet as parameters.
Refer above code. By using getParameter() method of Applet, u can take values inside applet. -
Signed applet communication on Mac
In Denmark homebanking is goin on the net with NetBank. My bank postulates that Mac users cannot participate, as signed applet communication is not supported on Macs.
I find it hard to believe an suspect that ActiveX components are the crook here.
Can anybody confirm my suspicion. Or clear my Bank :-)
I am Macin' 9.0.4ie - MRJ 2.2.5 . Explorer 5.0 or Netscape 6.0The bank probably says that because it doesn't have any Macs to test it on. Signed applets do work on Macs. However, not all of JRE 1.1 may be implemented in NS 4 or IE 5.0.
I think providing applet only access to Netbanking is a really dumb idea. Fortunately, my bank has not gone the applet route and I can use netbanking services just fine on my Mac with 128 bit encryption.
If I were you, I would just switch to a bank that is more Mac friendly... -
Servlet/Applet communication, data limit?
I have an applet that uses a servlet as a proxy to load/retrieve images from an Oracle database. I have a problem when trying to retrieve images larger than 9-10kb from the database. When using JDBC from a Java Application I don't have any probelms but through the Applet-Servlet configuration I do.
I use the following code in the Applet:
URL url =new URL("http","myserver",myport,"/servlet/MyServlet");
HttpURLConnection imageServletConn = (HttpURLConnection)url.openConnection();
imageServletConn.setDoInput(true);
imageServletConn.setDoOutput(true);
imageServletConn.setUseCaches(false);
imageServletConn.setDefaultUseCaches (false);
imageServletConn.setRequestMethod("GET");
byte buf[] = new byte[imageServletConn.getContentLength()];
BufferedInputStream instr = new BufferedInputStream(imageServletConn.getInputStream());
instr.read(buf);
Image image = Toolkit.getDefaultToolkit().createImage(buf);
// then code to display the image
And the following for the Servlet:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("image/gif");
byte[] buff = loadImage(); // this method returns a byte array representing the image.
response.setContentLength(contentLength);//contentLength is the size of the image
OutputStream os = response.getOutputStream();
os.write(buff);
os.close();
thanks in advance!thanks for your replay,
I tried your suggestion but whatever I do it seems that tha applet only brings the first 5-10k of the image from the servlet. This is the value I get from instr.read() or any other type of read method. The value of bytes is not always the same.
Now I also have something new. For images greater than 100k or so I get this error:
java.io.IOException: Broken pipe
at java.net.SocketOutputStream.socketWrite(Native Method)
at java.net.SocketOutputStream.socketWrite(Compiled Code)
at java.net.SocketOutputStream.write(Compiled Code)
at java.io.BufferedOutputStream.write(Compiled Code)
at org.apache.jserv.JServConnection$JServOutputStream.write(Compiled Code)
at java.io.BufferedOutputStream.write(Compiled Code)
at java.io.FilterOutputStream.write(Compiled Code)
at interorient.DBProxyServlet.doGet(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at org.apache.jserv.JServConnection.processRequest(Compiled Code)
at org.apache.jserv.JServConnection.run(Compiled Code)
at java.lang.Thread.run(Compiled Code)
I am using the Oracle Internet application server (ias 9i) which actualy uses the apache web listener.
It seems that this servlet-applet communication is really unstable. If you have anything that may help me it will be greatly appriciated. You can even e-mail me at [email protected]
thanks! -
Inter Applet Communication across frames - Help Needed
I am trying inter applet communication across frames. For this to happen I am using an intermidiate
class which registers two applets and whenever any applet needs reference of other applet it gets it
through this class.
The page is an important part of a navigation link. So it is loaded many times while traversing through
the site.
Every time I load this page the applet does not paint itself (shows grey or background) and the browser
stops responding. The machine needs to be restarted. This also happens when we keep that page idle for
a long time (say 2 hours - session does not time out but applet hangs). I have used another thread object
which is for utility and accesses the applet in the other frame every 10 seconds or so.
When the applet hangs it does ot throw any exception or JVM error. This happens on certain machines
evrytime and never on some machines. The applet hangs only in Microsoft IE 5 & 5.5 and never in Netscape
4.x.
What could be the problem?
Can anyone help me with this problem? Its a deadline project and I can't get through.
Thanks & Regards,
RahulTry making the register and getter methods of the intermediate class static synchronized. Then register the applets in their start() methods and unregister them in their stop() methods. Call the getter method of the intermediate class wherever you need access to another applet and never cache the instance you get. You may have to also synchronize all your start() and stop() methods to the intermediate class, as well as all methods that perform interapplet communication.
Tell me what happenned ... -
Applet to Applet communication in one browser process with 2 windows
Applet to Applet communication in Same IE process bu in different IE windows
I have two IE windows
(1) base window
(2) child window (created through wondow.open() and hence share the same IE process and same JVM)
Now I have two applets in one in base window and other is in child window and I want to do applet to applet communication. Since both applets are in different windows so AppletContext will not work and I tried to use custom AppletRegistory class to keep each Applet in static Hashtable. Now here comes the problem, Each applet gets different copy of this static Hashtable. i have tried hard to find the reason why a static varible has multiple copies running in the same JVM. Then my friend told me about something called class loader which is according to him is different for each window. I have tried this with two different iframes but in same window and it works fine and the reason being is that they share the same JVM. But why this fails for different windows althougt they also have same JVM?
I am using JRE v5 update 7 and IE6 on WIN XP SP2.
Thanks in advance..Try this example :
Files used :
1). AppletCom.html
2). First.java
3). Second.java
1).AppletCom.html
<HTML>
<BODY bgcolor="#FFFFFF" link="#0000A0" vlink="#000080">
<LI><H2><I>Inter applet communication Applet</I></H2>
<applet code=First.class name="theFirst" width=250 height=100></applet>
<applet code=Second.class width=350 height=100></applet>
<BR>
Source First.java Second.java
<P>
<HR>
<i>Last updated 8/5/97 Martin Eggenberger</i>
<HR>
</BODY>
</HTML>
2). First.java
import java.awt.*;
<applet code="First" width="200" height="200">
</applet>
public class First extends java.applet.Applet {
//Variables for UI
Label lblOutput;
public void init() {
//Create the UI
add(new Label("The First applet."));
lblOutput = new Label("Click on a button in the Second applet.");
add(lblOutput);
public Color getcc()
return Color.pink;
public String getnm(int a,int b)
int cnt=a+b;
String str;
str="Sum is :_________"+cnt;
return str;
public boolean handleEvent(Event event) {
if ("One".equals(event.arg)) {
lblOutput.setText("You clicked: One");
return true;
} else if ("Two".equals(event.arg)) {
lblOutput.setText("You clicked: Two");
return true;
} else if ("Three".equals(event.arg)) {
lblOutput.setText("You clicked: Three");
return true;
return super.handleEvent(event); }
3). Second.java
import java.awt.*;
import java.applet.*;
<applet code="Second.java" width="200" height="200">
</applet>
public class Second extends java.applet.Applet {
//Declare the UI variables
Button btnOne;
Button btnTwo;
Button btnThree;
Applet f;
Label lb;
public void init() {
//Build the UI
btnOne = new Button("One");
add(btnOne);
btnTwo = new Button("Two");
add(btnTwo);
btnThree = new Button("Three");
add(btnThree);
lb=new Label("SUNO RE KAHANI TERI MERI SHHHHHHH");
add(lb);
setLayout(new FlowLayout());
// lb.setSize(100,100);
public boolean handleEvent(Event event) {
if (event.id == Event.ACTION_EVENT && event.target == btnOne) {
f = getAppletContext().getApplet(new String("theFirst"));
First applet1=(First)f;
// int cnt=applet1.givenum(22,25);
// String str="Sum is:"+cnt+" Fine";
String str=applet1.getnm(22,25);
lb.setText(str);
Color cl=applet1.getcc();
setBackground(cl);
return f.handleEvent(event);
} else if (event.id == Event.ACTION_EVENT && event.target == btnTwo) {
f = getAppletContext().getApplet(new String("theFirst"));
return f.handleEvent(event);
} else if (event.id == Event.ACTION_EVENT && event.target == btnThree) {
f = getAppletContext().getApplet(new String("theFirst"));
return f.handleEvent(event);
return super.handleEvent(event);
I had this example, so i am sharing it as it is.. instead of giving you any link for tutorial... hope this helps.
Regards,
Hiten -
Is jre1.4 still support javascript to applet communication?
is jre1.4 still support javascript to applet communication?
I can't get the method in applet from javascript in jre1.4. Are there have a different way to communication?I have a similiar problem. Left a post in the Signed Applet board. I can get the methods called on my applet when operating over HTTP, but when I am on a page served from HTTPS, the browser chews up memory, goes to 100% processor utilization, and the method is never called. This is with the 1.4 plugin.
Suppose this is related ? -
Applet to Applet communication between two seperate threads and jsp pages
Hi,
have two java applets running on two separate jsp pages. I am trying to have one applet talk to the other applet. I have tried putting the applets in a static hashtable, but I found out (through trial and error) that the memory is not shared between the applets. Needless to say the appletcontext object will not work as well. I have also tried to put the applet threads into a thread group, but it seems that the second applet can't find the first applet's threads. Is there a funky way that I need to create the threads for the threadgroup? Is there a way or type of object that I can use that will share the static memory between plugins? I am using 1.6 in IE. Or am I looking at this wrong and there is an easy way to do this and I am not seeing it.
Thanks,
MarcHi Mylene,
I hope I have understood your problem correctly. I can try to give you a tip. The times I've had to do a pop-up, for instance to show details or a part of the data in a table, I call a javascript function with the required parameters (an ID for details or an array of rows) when the button is pressed or a link is clicked. The function then builds a URL with all the paremeters and uses it to call the standard window.open function. After that the request is handled "as usual", ie as if you didn't actually do a pop-up but simply displayed a new page. The content of the pop-up is a jsp with all the required code to build the table and/or display the data. The contents of the table or data are retrieved with the help of the parameters sent.
I'm not sure if the portal kit provides some kind of standard functionality for this, but in the cases I've worked with J2EE solutions this has been the most common way of solving the problem.
I hope this helps.
kind regards,
Dionisios -
Hi all ,
I know this question has been asked so many times and I have read all the posts but still i was unsuccessful.
I am trying to send a string from a jsp to another jsp which is loading the applet to display that string.
In my first jsp:
<form method=post action="hello.jsp">
<input type="text" name="formDesc" value="IBMTR/ABMTR Form" size="20" maxlength="20">
<input type=submit name="Go" class="submituttontext" value="Go">
</form>
in my seccond jsp:
<APPLET CODE="ParamTest.class" WIDTH="400" HEIGHT="50">
<PARAM NAME="font" VALUE="Dialog">
<PARAM NAME="size" VALUE="24">
<PARAM NAME="string" VALUE="Hello, world ... it's me. :)">
<PARAM NAME="formDesc" VALUE="<%=request.getParameter("formDesc");%>">
</APPLET>
in my applet:
String myFont = getParameter("font");
String myString = getParameter("string");
int mySize = Integer.parseInt(getParameter("size"));
String desc =getParameter("formDesc");
Font f = new Font(myFont, Font.BOLD, mySize);
g.setFont(f);
g.setColor(Color.red);
g.drawString(myString, 20, 20);
g.drawString(desc, 40, 40);
but nope i cannot see...formDesc ..I jus see the <%=getParameter%>
ThanxAt first glance the only error I see is:
<PARAM NAME="formDesc" VALUE="<%=request.getParameter("formDesc");%>">
should be changed to:
<PARAM NAME="formDesc" VALUE="<%=request.getParameter("formDesc") %>">
No semicolon in expressions. This should give you JSP compile error, so maybe that was just a typo in your post and not the real problem.
Let me know. -
Invoke a method in JSP from applet?
Hi,
Does anyone know how to invoke a method defined in JSP when a button within an applet is clicked?
Thanks in advance.Hi
What you are trying is basically an Applet to Servlet communication. This is definitely possible. To perform a GET to a Servlet create a URL object with the request parameters included. Create a URLConnection by opening a connection to the URL object. Then access the ServletInputStream to get the reply from the Servlet.
To perform POST the process is similar but remember to set the DoInput and DoOutput properties of the URLConnection object to true.
Obtain the ServletInputStream and ServletOutputStream to recieve and send Data.
Keep me posted on your progress!
Good Luck!
Eshwar Rao
Developer Technical Support
Sun microsystems inc.
http://www.sun.com/developers/support -
Is there anyway to load a JSP from within an applet?
If you want to display the output of the jsp in a GUI object in the applet you can use the HttpURLConnection class. This will allow you to call the jsp and retrieve the response. How to display is up to you. Nor do I know how you would handle javascript or CSS.
If you want the JSP to be displayed in the browser window that the applet window is running in, look into using JavaScript and LiveConnect.
Maybe you are looking for
-
Hi - I'm trying to use FTDI drivers to simulate a COM port from an USB connection. Most WinXP SP2 or 3 machines have no problem, but I have one machine where having run MAX to ensure correct port operation, on quit and relaunch MAX shows a port confl
-
Why am I unable to download os x mavericks on my new macbook pro with retina
-
Cisco Prime Network 4.0
Hi, Has someone installed Cisco Prime Network on another distribution than Redhat ? I want to install a local demo and I have only RedHat trial. What is the optimal mode of installation Prime Network ? Unit + GW and DB on the same machine?
-
Adobe Update Server - Web Premium CS5.5 - Error Code: U41M1C213
Good Afternoon All! I've just received the site licence for Adobe Web Premium CS5.5 and installing the Adobe Update Server. I can browse to the xml file on the client (which just displays a number), and I've downloaded all the updates etc. restarted
-
I am facing problem in using viber...can not receive any call from Viber whn keypad is locked and whn i unlock phone thn on opening viber i can see the missed call notification... kindly guide me there is any setting so0 tht i can receive viber call