Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Question passing value from jsp to applet

    Hi



    I have been stuck with jftp applet for a long time. I donít have any idea about how to pass value from jsp to applet at run time.



    The current JFtpApplet code is given below



    Public class JFtpApplet extends Applet

    {

    Public JFtpApplet ()

    {

    AccessController.doPrivileged (new PrivilegedAction())

    {

    Public Object run ()

    {

    JFtp.main(new String[0]);



    return new Object();

    }

    });

    }



    This class internally calls the main method of JFTP class which will start the applet. The main method normally takes string array as an input parameter. I want this string array to be initialized in the JFtpApplet class and the value to this array has to be passed from JSP. Is it possible with the current design of JFtpApplet class to take the value from jsp? If yes then can u give me a sample code where this has been done? Is there any flaw in the JFtpApplet code because

    I have tried using getParameter method (this approach was given on net) in the JftpApplet class but have not been able to see the value getting passed from jsp to applet.



    Thank you.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    how to pass value from jsp to applet at run time
    Let me restate this to be sure I understand what you are trying to do.
    Your jsp code on a server generates some HTML that includes an <APPLET tag in response to a browser's request.
    The browser that reads the generated HTML and then reads the java class files or jar file for the applet. The applet starts execution.
    At this point you want applet get a value from the jsp. Is that it?
    The applet can either get the value from a <PARAM tag that would be generated by the jsp when it created the HTML or it could use an HTTP connection to request the info from the server.

  3. #3
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Default Thanks

    Thanks for the reply . You have understood it correctly what i want to do

    Can u give me some sample code for doing the same i have already tried what you are saying but have not succeeded it al . Can you give me both the jsp code where the param tag is used to pass parameter and applet code where the parameter can be retrieved ?

  4. #4
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Default Hi

    For your reference i will show you my jsp code
    <html>
    <head>
    <title>Simfonie Bulk Upload Applet</title>
    </head>
    <body>
    <h1><b>Simfonie Bulk Upload Applet<b></h1>
    <hr>
    <jsp:plugin type="applet" code='net.sf.jftp.JFtpApplet' codebase="<%= request.getContextPath() %>/module/fs/bulklib"
    width="250"
    height="50"
    archive="sjftp_mod.jar">
    </jsp:plugin>
    </body>
    </html>

    My sjftp_mod.jar is in the bulklib folder but using java plug-in is always giving me this error
    ServletException in '/module/fs/jsp/fsBulkUpload.jsp': /module/fs/jsp/fsBulkUpload.jsp(8,69) attribute for %>" is not properly terminated

    I am able to run it using the following in my jsp
    <applet java_codebase="<%= request.getContextPath() %>/module/fs/bulklib"
    archive='sjftp_mod.jar' code='net.sf.jftp.JFtpApplet' height=500
    width=500></applet>

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    I'd first design the HTML code to be generated, then code the jsp to generate that code. Do you have the HTML that you want?
    What you show doesn't have the <PARAM tag in it.

Similar Threads

  1. Passing a value..
    By Lagarto in forum New To Java
    Replies: 3
    Last Post: 01-23-2011, 05:58 PM
  2. Need help passing data between classes
    By bri1547 in forum New To Java
    Replies: 3
    Last Post: 07-21-2008, 04:19 AM
  3. Passing objects in Java
    By jbostjr in forum Advanced Java
    Replies: 1
    Last Post: 10-30-2007, 05:57 PM
  4. Passing the Values
    By Lagarto in forum JDBC
    Replies: 1
    Last Post: 07-16-2007, 03:03 AM
  5. Replies: 4
    Last Post: 06-08-2007, 06:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •