JSP Applet communication

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%>
Thanx

At 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.

Similar Messages

  • 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 &#169; 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();
    }

  • JSP applet tag X Html applet tag (what is the difference?)

    what is the advantage in using the JSP applet tag instead of a simple Html applet tag ?
    second question:
    I have an applet in a Html frame, and a menu on the left side.... When the user select the applet option at first time, everything runs ok.. after the user select another option and then select the applet again, it fails in some features .. Why ?

    well, if by "the JSP applet tag", you mean the jsp:plugin tag.. that will just generate the same HTML tag you would write. The only advantage would be it should be less typing to use the taglib.
    second answer:
    without seeing any code, it'd be hard to figure out the problem. The obvious thing is you are setting some state of something that is preventing further action.

  • 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.0

    The 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...

  • JSP & APPlet - HTML

    Hi All,
    I am new to web development platform. I know core java, now as I need to proceed to web development I would like to know certain concepts / languages used.
    Jsp - Jsp is used to develop webpages, how does it differ from html.
    Applets - We can develop web pages using applets. Then what are the circumstance we use applets, jsp.
    JSP & Applets - Can JSP and Applet both used to create a webpage? If yes how?
    Kindly answer my question. Thank you.
    Regards,
    lg

    Go look up a basic tutorial dude.
    Basically JSP lets you create an HTML page on the fly. Rather than just serving up a static page, you customise it for each request.
    This gives a pretty good example of how JSP fits into things
    http://www.javaranch.com/journal/200510/Journal200510.jsp#a1
    Applets - Its a program running on a web page. I kinda lump them into the same box as "flash" and "activex". They let you step outside the bounds of html which a webpage is tied to. That has both advantages and disadvantages. Most web applications don't use applets.

  • JSP, APPLET and JNLP

    OK, here is my question, we have a simple (sic) application, which consists of jsps, applets ( Runtime.exec ), I have been suggested to use jnlp and jws, A typical JSP page looks like this.
    <% %>
    :Bunch of JSP /HTML stuff
    <APPLET>
    </APPLET>
    Bunch of jsp/HTML/javascript stuff
    How should i go about changing it to jsp + jnlp, Any insight is helpful.
    Thanks.

    OK, here is my question, we have a simple (sic) application, which consists of jsps, applets ( Runtime.exec ), I have been suggested to use jnlp and jws, A typical JSP page looks like this.
    <% %>
    :Bunch of JSP /HTML stuff
    <APPLET>
    </APPLET>
    Bunch of jsp/HTML/javascript stuff
    How should i go about changing it to jsp + jnlp, Any insight is helpful.
    Thanks.

  • 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,
    Rahul

    Try 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 ?

  • 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.

  • 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,
    Marc

    Hi 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

  • 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.

  • JSP - Applet Object communication.

    Hi,
    I would like to know, what is the best way to pass Java Objects to Applet.
    My module requires a complex JTree to be dynamically constructed by the Applet, thus making the Applet very process intensive.
    To optimize the performance I want to write some components to generate the TreeModel (or relevant Value Objects) and the components will just pass objects to the Applet.
    In short I am trying to implement it as a MVC architecture, where my Applet is a thin View.
    However I do not know how to pass objects to Applets, I believe <param> tags are only useful for passing String datatypes, hence I am looking for alternatives, any recommendations on patterns/perfomance issues are welcomed.
    Thanks.
    Rgds,
    Shafique Razzaque,
    Singapore.

    Previous poster has a point. However, this is a way of reading an object through an ObjectInputStream.
    String servletLoc = "http://10.10.10.10/servlet/Servlet";
    URL servletURL = new URL(servletLoc);
    URLConnection servletConnection = servletURL.openConnection();
    servletConnection.setUseCaches (false);               
    servletConnection.setDefaultUseCaches(false);               
    servletConnection.setDoInput(true);
    servletConnection.setRequestProperty("Content-type", "application/octet-stream");
    ObjectInputStream inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());    
    JTree someTree = (JTree) inputFromServlet.readObject();

  • JSP - Applet problem

    Hi
    How do I call an Applet from JSP?
    I have a applet that talks with jsp which talks to a bean, the connection between jsp and the bean is okay but between jsp and the applet im not sure how to do. Any suggestions?
    Jonas

    Yes JSP is an extension of Servlets, bu you have to understand the difference and the need why JSP's are created and where it fits the best. For you situation I assuming you want to access a JSP page which has an applet in a browser, then to interact the applet which needs to communicate the server it came from(not necessarily that particular JSP). If that is the case you need and a Servlet for the rest of the communication(Servlets are better choice whent there is no presentation going back to the client) which is just exchange of data between the servlet and the Applet.
    The Applet and the servlet could communicate through sockets or URLConnection or even RMI which ever you feel more convertible(RMI if you are passing objects).

Maybe you are looking for