Embedding Applets in JSP

Hello all,
          I have an unusual requirement . Part of my Java applet has parameters
          like this.
          I am embedding this java applet into a JSP page
          << portions of applet reproduced below>>
          VALUE = '
          Param1 = "Multiple Bars and Lines Combo";
          Param2 = "test0"
          Param3 = "test1";
          Param4 = "test2";
          Background = ("Some string1","Some string 2",12,2);
          HeaderBox = (null,NONE,5,null,TILE,black);
          Legend = ("",black,"SansSerif",10,0);
          Goes on and on and on . Very big
          >>
          I dont want to write it in my JSP page as it would become very big. I
          have 2 or three applets.
          But making a JAva class to return this applet string is posing to be a
          problem. This is because of a large number of characters like Comma,
          Semicolon, brackets.
          which will give an error if i compile. Of course, i can write escape
          characters. I will be having several hundred escape characters.
          Anyone have a solution to this?. How can i return the applet
          definition as a string to my JSP form?. Note that some parameters may
          change as i have to embed more than one applet. Can i store this as a
          string somewhere and return this back with a few parameters changed?.
          I ampassing parameters to the applet froim my JSP page.
          Thanks, very much in advance
          

One idea is to store it in a property file / resource bundle, which even has
          a
          mechanism for parameter replacement, internationalization, etc.
          See:
          http://developer.java.sun.com/developer/technicalArticles/Intl/IntlIntro/
          For big files you may be interested in the following tool:
          http://oss.software.ibm.com/icu4j/demo_tools/RBManager.html
          regards,
          -Ade
          "jock" <[email protected]> wrote in message
          news:[email protected]...
          > Hello all,
          >
          > I have an unusual requirement . Part of my Java applet has parameters
          > like this.
          > I am embedding this java applet into a JSP page
          >
          > << portions of applet reproduced below>>
          > VALUE = '
          > Param1 = "Multiple Bars and Lines Combo";
          > Param2 = "test0"
          > Param3 = "test1";
          > Param4 = "test2";
          > Background = ("Some string1","Some string 2",12,2);
          > HeaderBox = (null,NONE,5,null,TILE,black);
          > Legend = ("",black,"SansSerif",10,0);
          > Goes on and on and on . Very big
          > >>
          >
          > I dont want to write it in my JSP page as it would become very big. I
          > have 2 or three applets.
          > But making a JAva class to return this applet string is posing to be a
          > problem. This is because of a large number of characters like Comma,
          > Semicolon, brackets.
          > which will give an error if i compile. Of course, i can write escape
          > characters. I will be having several hundred escape characters.
          >
          > Anyone have a solution to this?. How can i return the applet
          > definition as a string to my JSP form?. Note that some parameters may
          > change as i have to embed more than one applet. Can i store this as a
          > string somewhere and return this back with a few parameters changed?.
          > I ampassing parameters to the applet froim my JSP page.
          >
          > Thanks, very much in advance
          

Similar Messages

  • Re: Embedding Applet in JSP which gets dynamic input| Pls help

    Hi All,
    We are into a project in Oracle Portal Server where in we want to embed a result of a standalone application(Which is applet) in JSP.
    This standalone application generates applet based on the input it gets from the current application's database.
    If it was static we could have used jsp:plugin but, it fails in our case!
    We are clueless as to how to embed an applet which will pick up the data dynamically.
    Can anyone of you help me in this regard?
    Thanks & Regards
    Arthi

    Well instead of generating entire applet ,you can have a generic applet which takes parameters as ( <PARAM name="name" value="value"> ) inputs and process those inputs to generate output.
    In this case the output of the stand alone program would be a object. And in JSP page you need to access this object, then you can get the values which need to be passed to Applet.
    Else
    1.Identify the real path of the applet class file
    ServletContext context = session.getServletContext();
    String realContextPath = context.getRealPath(request.getContextPath());2.Copy the file to a standard location in your web application
    Regards,
    -John-

  • Re: Embedding Applet which takes dynamic input, into JSP | Need help

    Hi All,
    We are into a project in Oracle Portal Server where in we want to embed a result of a standalone application(Which is applet) in JSP.
    This standalone application generates applet based on the input it gets from the current application's database.
    If it was static we could have used jsp:plugin but, it fails in our case!
    We are clueless as to how to embed an applet which will pick up the data dynamically.
    Can anyone of you help me in this regard?
    Thanks & Regards
    Arthi

    You can call an applet's public methods from JavaScript.
    (And even the other way around, using JSObject).

  • Re: Including Applet in JSP with Dynamic input| Help needed

    Hi All,
    We are into a project in Oracle Portal Server where in we want to embed a result of a standalone application in Portal page.
    We can do that once we can embed the result of the standalone application which generates applet based on the input it gets from the current application's database.
    If it was static we could have used jsp:plugin but, it fails in our case!
    We are clueless as to how to embed an applet which will pick up the data dynamically.
    Can anyone of you help me in this regard?
    Thanks & Regards
    Arthi

    Hi Arthi,
    I think this might help you to get an idea why jsp:plugin tag does not allow for dynamically called applets.
    <jsp:plugin type=applet height="100%" width="100%"
    archive="myjarfile.jar,myotherjar.jar"
    codebase="/applets"
    code="com.foo.MyApplet" >
    <jsp:params>
    <jsp:param name="enableDebug" value="true" />
    </jsp:params>
    <jsp:fallback>
    Your browser does not support applets.
    </jsp:fallback>
    </jsp:plugin>
    The plugin example illustrates a <html> uniform way of embedding applets in a web page. Before the advent of the <OBJECT> tag, there was no common way of embedding applets. This tag is poorly designed and hopefully future specs will allow for dynamic attributes (height="${param.height}", code="${chart}", etc) and dynamic parameters. Currently, the jsp:plugin tag does not allow for dynamically called applets. For example, if you have a charting applet that requires the data points to be passed in as parameters, you can't use jsp:params unless the number of data points are constant. You can't, for example, loop through a ResultSet to create the jsp:param tags. You have to hand code each jsp:param tag. Each of those jsp:param tags however can have a dynamic name and a dynamic value.
    I think you can get better information if you look in to the below link
    http://pdf.coreservlets.com/CSAJSP-Chapter12.pdf
    Many Thanks,
    Ramesh.

  • Error Diplaying TIFF in Applet through JSP

    Dear All,
    I've been trying to display the Tif image into the WebBrowser with the help of Applet embedded into a JSP through NetBeans IDE.
    To achieve this goal, I've created 2 projects "NewApplet" which contains the Applet class and "WebApplication1" which has "Index.JSP" which embeds the Applet.
    If i execute Only the Applet, it displays the TIF. But if i execute the JSP, it fires the following error:
    "URL Scheme is not "file" http://localhost:8084/WebApplication1/alpesh.tif""
    Following is the code written NewApplet.Java:
    {code}package display;
    import javax.swing.JApplet;
    import java.awt.BorderLayout;
    import java.awt.image.RenderedImage;
    import java.io.IOException;
    import javax.swing.JDesktopPane;
    import javax.swing.JInternalFrame;
    import javax.swing.JScrollPane;
    import com.sun.media.jai.codec.ImageCodec;
    import com.sun.media.jai.codec.ImageDecoder;
    import com.sun.media.jai.codec.TIFFDecodeParam;
    import com.sun.media.jai.widget.DisplayJAI;
    import java.io.File;
    import java.io.FileInputStream;
    import java.net.URI;
    import javax.swing.JOptionPane;
    public class NewApplet extends JApplet {
    @Override
    public void init() {
    URI FileName = URI.create(getCodeBase().toString().concat(getParameter("imageSource")));
    try
    File f = new File(FileName);
    FileInputStream stream = new FileInputStream(f);
    // Create a decoder using that stream.
    TIFFDecodeParam tiff = new TIFFDecodeParam();
    ImageDecoder dec = ImageCodec.createImageDecoder("tiff", stream, tiff);
    // Get the number of pages.
    int pages;
    pages = dec.getNumPages();
    // Set the application title.
    setTitle(pages+" pages in "+filename);
    // Create a JDesktop to hold the pages in internal frames.
    JDesktopPane desktop = new JDesktopPane();
    //getContentPane().add(desktop,BorderLayout.CENTER);
    desktop.setSize(400,400);
    add(desktop,BorderLayout.CENTER);
    // Open all images in the TIFF into the desktop pane.
    for(int i=0;i<pages;i++)
    // Get the image.
    RenderedImage ri = dec.decodeAsRenderedImage(i);
    // Create and set the user interface of an internal frame.
    JInternalFrame jif = new JInternalFrame("Page "+i,true,true,true,true);
    jif.getContentPane().add(new JScrollPane(new DisplayJAI(ri)));
    jif.setSize(400,400);
    jif.pack();
    jif.setVisible(true);
    // Add the internal frame to the JDesktop.
    desktop.add(jif);
    // Set the application closing behaviour, frame size, and show it.
    //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(400,400);
    setVisible(true);
    catch (Exception e)
    JOptionPane.showMessageDialog(this, e.getMessage(), "alert", JOptionPane.ERROR_MESSAGE);
    {code}
    Following is the code written Index.JSP:
    {code}
    <APPLET code="display.NewApplet" ARCHIVE="NewApplet.jar" width=350 height=200>
    <param name ="imageSource" value="alpesh.tif"/>
    </APPLET>
    {code}
    Any Guesses?
    I've added the "dist/NewApplet.jar" in WebApplication1 through the option of "Properties->Build->Packaging" in NetBeans.
    Please help!
    - Alpesh

    Hi;
    This browser does not support Applets.What is yout browser?Please see:
    Recommended Browsers for Oracle E-Business Suite Release 12 [ID 389422.1]
    Recommended Browsers for Oracle E-Business Suite 11i[ID 285218.1]
    Regard
    Helios

  • How to embedd applet into JSP

    Hi,
    In my application I need to get the windows userId and credential data's in applet. That applet should be embedded into JSP. How I can do that? Can anyone help me on this please.....?
    Thanks in advance...

    JSP Plugin Syntax
    <jsp:plugin
    type="bean | applet"
    code="classFileName"
    codebase="classFileDirectoryName"
    [ name="instanceName" ]
    [ archive="URIToArchive, ..." ]
    [ align="bottom | top | middle | left | right" ]
    [ height="displayPixels" ]
    [ width="displayPixels" ]
    [ hspace="leftRightPixels" ]
    [ vspace="topBottomPixels" ]
    [ jreversion="JREVersionNumber | 1.1" ]
    [ nspluginurl="URLToPlugin" ]
    [ iepluginurl="URLToPlugin" ] >
    [ <jsp:params>
    [ <jsp:param name="parameterName" value="{parameterValue | <%= expression %>}" /> ]+
    </jsp:params> ]
    [ <jsp:fallback> text message for user </jsp:fallback> ]
    </jsp:plugin>
    *Examples*
    <jsp:plugin type=applet code="Molecule.class" codebase="/html">
    <jsp:params>
    <jsp:param name="molecule" value="molecules/benzene.mol" />
    </jsp:params>
    <jsp:fallback>
    <p>Unable to load applet</p>
    </jsp:fallback>
    </jsp:plugin>

  • Applet to jsp comm

    I have a few objects in an applet embedded in a jsp file now i want to read these objects in a jsp page as i wish to write the object's values to the databasethe jsp page can be a new one as i think that passing data to the same page is not possible as it is loaded long before the applet is loaded plz write a sample code if possible!!

    JSP executes at server side and generates HTML content. When this HTML content is rendered in browser at clients machine applets (if there is any) are invoked and executed in browser. So data objects in your applet will be available much later.
    From your applet call a server side component (perhaps a Servlet or JSP) using java.net.URLConnection (look into java.net API) and pass your data objects. Now from your target Servlet or JSP you can easily write data into database or file.
    Thanks,
    Mrityunjoy

  • How to import and display an applet from JSP

    i m using netbeans 5.0
    i have class named myapplet.class
    and jsp named myjsp.jsp
    now i want to access(import) this myapplet.class from jsp
    also i want to display this applet from this jsp
    i am able to do either thing but not both
    so please help me it is so urgent and important for me bcoz
    i have to complete my project as early as possible
    Thanks in advance

    my jsp source file page path is D:\Reliance
    project\WebApplication3\web\
    and classes path is D:\Reliance
    project\WebApplication3\build\web\WEB-INF\classes\
    so problem is that if i want to use myapplet.class
    then i have to put my class in D:\Reliance
    project\WebApplication3\build\web\WEB-INF\classes\
    location
    but at that time i am not able to display this applet
    on my jsp
    if i put my myapplet.class in
    D:\Reliance project\WebApplication3\web\ then i m
    able to display
    applet but not able to access(import) this class
    hope you will got the problem!!!
    thanks for your reply !!!try to set the path of your applet on jsp something like this
    "WEB-INF/classes/myclass.class"

  • How can I pass a variable to an applet in JSP?

    I want to invoke an Applet in JSP and pass a variable( ie. port) to the Applet. I do as follows:
    <applet code="best.Applet1.class" width=400 height=300 >
    <param name=port1 value=port>
    </applet>
    in Applet1.java , I use getParameter("port1"),yet I got character string "port" ,not the value of port(i.e. 100).
    How can I get 100 not "port"? Thanks!!!

    Assuming that port is a variable defined and initailized in the jsp:
    <applet code="best.Applet1.class" width=400 height=300 >
    <param name=port1 value=<%= port %>>
    </applet>

  • Handling events in javascript which are generated by embedded applet

    I am having an tipical requirement , In my HTML page there is an embedded applet . This applet is going to generate custom events . I would like to handle that events in javascript which are generated from applet . I mean that javascript has to get a notification of the event that is generated from applet . I would appreciate if some one can send me the code .

    Hi look at my post further down about 5-6 posts. It's called: "For your information. Very interesting." It talks about Netscapes Live Wire.

  • Applet in JSP page

    Hello! I wrote an applet and try to put in jsp page in JDeveloper:
    <jsp:plugin type="applet" code="CompositeTest.class"
    width="400" height="400">
    <jsp:fallback>
    <p>Unable to load applet</p>
    </jsp:fallback>
    </jsp:plugin>
    and I copy the class file to folder where the JSP page is located. When I start Jsp page I have a message: "Applet not found"
    What I do wrong??? PLZ Help!
    BEST REGARDS

    Hi,
    I am not sure the JSP file, which resides in the public_html directory, is part of the class path of the running application. If you open the project properties, you can see where JDeveloper looks for Java classes. Try and extend this setting to include the public_hml directory (you can also try and just add the source as a library path (see library section))
    Frank

  • Calling applet in JSP

    i have already made an applet code for my program....now i want to make it flexible by using JSP...
    Should i write the code from scratch (for JSP)....or is there some way i can call the applet from JSP ...
    Please suggest.

    see if this thread helps you
    http://forum.java.sun.com/thread.jsp?forum=45&thread=166514
    Cheers
    Khalid

  • Calling applet in jsp file

    Hi al,
    When we try to invoke an applet from jsp, applet class is not able to initialize (not able to load the class)
    Exception got in java console as follows :
    Load: class SignedAppletDemo.class not found.
    java.lang.ClassNotFoundException: SignedAppletDemo.class
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
    at sun.applet.AppletClassLoader.getBytes(Unknown Source)
    at sun.applet.AppletClassLoader.access$100(Unknown Source)
    at sun.applet.AppletClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 10 more
    We are using <jsp:plugin> tag for access applet from jsp in Oracle Appserver.(OC4J).
    If anyone have any idea on the above,please let us know. Please pass on steps to follow for access applet from jsp file.
    Thanks,
    Rajkumar

    Review
    URL.openConnection()
    and HttpURLConnection

  • Applets in Jsp generates ClassNotFoundException

    hi there,
    I face a problem of calling applets in Jsp.
    The code to call applet is:
    <jsp:plugin type="applet"
    code="core.TextApplet"
    width="475" height="350">
    </jsp:plugin>
    And I have a 'core' directory in source packages and TextApplet.java in core directory.Wehn I run the TextAppletJSP ,it gives me an error message in applet display area:
    Exception:java.lang.ClassNotFoundException:core.TextApplet
    Anyone who help me for this problem plz.
    thanks for your help.
    gezahegn

    I am also getting out of memory errors, and Tomcat keeps increasing in memory on every page refresh. Please let me know if you get this resolved how you did it. Thanks.

  • Unable to load Applet in JSP using Tomcat 5.5.12

    Hi
    I am aunable to applet in jsp using Tomcat 5.5.12 and JRE 1.5. Below is the code that I am using
                                       <applet
                                       codebase = "."
                                       archive = "WebPOSApplet.jar"
                                       code = "webposprint.WPMainApplet.class"
                                       name = "Trans Applet"
                                       width = "450"
                                       height = "115"
                                       hspace = "0"
                                       vspace = "0"
                                       align = "middle"
                                       >
    <param name = "redirectInfo" value = "SearchProducts.do">
                                       </applet>
    <%/*%>
    <OBJECT
                                       classid = "clsid:CAFEEFAC-0014-0002-0000-ABCDEFFEDCBA"
                                       codebase = "http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,2,0"
                                       WIDTH = 450 HEIGHT = 115 >
    <PARAM NAME = CODE VALUE = webposprint.WPMainApplet.class>
    <PARAM NAME = archive VALUE = WebPOSApplet.jar>
    <PARAM NAME = "type" VALUE = "application/x-java-applet;jpi-version=1.4.2">
    <param name = "redirectInfo" value = "SearchProducts.do">
    <PARAM NAME = "scriptable" VALUE = "false">
    <PARAM NAME = model VALUE=models/buckminsterfullerine.xyz>
    <embed width="450" height="115" code="webposprint.WPMainApplet.class" archive="WebPOSApplet.jar" type="application/x-java-applet;jpi-version=1.4.2" redirectinfo="SearchProducts.do" scriptable="false" model="models/buckminsterfullerine.xyz" src="webposprint.WPMainApplet.class">
    </embed> <COMMENT> <EMBED
                                       type = "application/x-java-applet;jpi-version=1.4.2" \
                                       CODE = webposprint.WPMainApplet.class\
                                                 archive = WebPOSApplet.jar\
                                       WIDTH = 373 \
                                       HEIGHT = 167 \
                                       model =models/buckminsterfullerine.xyz \
                                            scriptable = false \
                                            pluginspage = "http://java.sun.com/products/plugin/index.html#download"> <NOEMBED>
    alt="Your browser understands the <APPLET>
    tag but isn't running the applet, for some reason."
    Your browser is completely ignoring the <APPLET>
    tag! </NOEMBED> </EMBED> </COMMENT>
    </OBJECT>
    <%*/%>
    This code doesn't seems working with Tomcat 5.5.12. I works fine with Tomcat 4.1.31
    Please help
    Thanks

    Applets run client side - which means the relevant class files need to be downloaded to the client.
    Anything under the WEB-INF directory is not directly accessible by the client. Nothing under WEB-INF can be downloaded.
    ergo, specifying the WEB-INF directory as part of your applet codebase is a bad idea.
    I would suggest try copying the applet classes from under WEB-INF to some other place in your application.
    Also, you should probably specify the full class name of your Applet in the plugin tag.
    <%@ page import="com.util.MyApplet" %>
    <jsp:plugin type="applet" code="com.util.MyApplet" codebase="/classes" width="250" height="100" jreversion="1.6">
         <jsp:fallback>
              <B>Unable to start plugin!</B>
         </jsp:fallback>
    </jsp:plugin>cheers,
    evnafets

Maybe you are looking for

  • Previewing audio in Mountain Lion is slow and choppy

    Hi! I'm a music producer and therefore i have countless gigabytes of drum snippets. Now, on my old macbook that runs snow leopard i can browse through all the audio files super quick (by hitting space and go into preview mode), but when i got my imac

  • Can't open a pdf file attachement to e-mail

    I canot open an e-mail pdf file attachment..I get a message You have chosen to open Invoice---pdf which is: Firefox HTML Document (479kB) What should Thunderbird do with this file? Open with Firefox (default) I do all of the above but nothing happens

  • Download of tutorial schema is corrupt

    Most of the example jdeveloper tutorials require a schema which cannot be downloaded as the zip file is corrupt: http://www.oracle.com/technetwork/developer-tools/jdev/index-095536.html Then on the download link after the text below. Installing the S

  • BAPI :   simulate IN  TRANSACTION MIRO

    Can anyone tell me a bapi   that can do the same work as the button   "simulate" IN  TRANSACTION MIRO   ? Edited by: liwei zhuang on Jan 18, 2008 12:15 AM

  • Editing Local Dynamic Pages - How To?

    I figure this should be something simple but I can't seem to figure out how to do it. In the past I believe this is something I was able to do in DW. I've set up my website locally running off my local server and everything there seems to be working