Get Java Version from Applet to JSP

Hi Forum!
I am trying to collect client information with a jsp page and put the information into a html form.
Besides the request information and some javascript screensize and flash version information I'd like to get the client's Java Version and Vendor with System.getProperty("java.version").
I assume I can get this info only with an applet.
How do I pass the Applet's version result to the JSP so I can view it with HTML and insert it into the form?
Thanks a lot,
Tom

You would use liveconnect and the JSObject class to connect the Java code in the applet to JavaScript in the browser to populate the HTML:
http://www.gsu.unibel.by/pub/javascript/ch19_06.htm
http://www.apl.jhu.edu/~hall/java/JavaScript-from-Java.html

Similar Messages

  • How to get a value from applet in jsp?

    Dear all,
    I have a jsp page which includes a applet (in a form). User click to my applet and get the value.
    and the jsp form can capture the value of the applet and send to servlet.
    Is it possible?
    If it is possible, how to do that?
    Thanks.
    Regards,
    Kin

    Hi,
    Yes it is possible. You have to use LiveConnect.
    The classes required are netscape.javascript.*
    They are located in the jaws.jar file (jre/lib).
    Here is a copy of the page found at http://www.rgagnon.com/javadetails/java-0177.html
    Read/Write HTML field values from JAVA
    [Netscape AND IE4 compatible]
    The netscape.javascript.* (LiveConnect) package provides facilities to directly manipulate HTML FORM components.
    JSObject win = (JSObject)JSObject.getWindow(this);
    JSObject HTMLInputText = (JSObject) win.eval("document.forms[0].elements[0]");
    String testValue = (String)HTMLInputText.getMember("value");  // read form value
    HTMLInputText.setMember("value" , testValue + "new stuff");  // write form valueBut this action requires a signed applet. in Netscape, you must PrivilegeManager.enablePrivilege("UniversalBrowserRead");
    PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
    before using an JSObject related to an HTML document.
    But there is a workaround, simply pass the informations through Javascript functions!
    [JSjava.java]
    import java.applet.*;
    import java.awt.event.*;
    import java.awt.*;
    import netscape.javascript.*;
    public class JSjava extends Applet
         implements ActionListener {
    Button b1,b2;
    TextField tf;
    JSObject win;
    public void init(){
      setLayout(new FlowLayout());
      tf = new TextField(10);
      b1 = new Button("to FORM");
      b2 = new Button("from FORM");
      b1.addActionListener(this);
      b2.addActionListener(this);
      add(tf);add(b1);add(b2);
    public void actionPerformed(ActionEvent ae) {
      if (ae.getSource() == b1) {
         // send TO FORM
         JSObject win = (JSObject)JSObject.getWindow(this);
         win.eval("setHTMLInputText('"+tf.getText()+"');");
      if (ae.getSource() == b2) {
         // receive FROM FORM
         JSObject win = (JSObject)JSObject.getWindow(this);
         tf.setText((String)win.eval("getHTMLInputText();"));
    }[JSjava.html]
    <HTML><HEAD>
    <SCRIPT>
    function getHTMLInputText(){
      return document.forms[0].elements[0].value;
    function setHTMLInputText(s){
      document.forms[0].elements[0].value = s;
    </SCRIPT></HEAD><BODY>
    <FORM>
      <INPUT TYPE=text SZIE=20>
    </FORM>
    <APPLET NAME="JS" CODE=JSjava.class MAYSCRIPT WIDTH=200 HEIGTH=200>
    </APPLET></BODY></HTML>Regards,
    Denis.

  • How to invoke Java class from post.POST.jsp

    Hi All,
    I am trying to invoke a simple java method from post.POST.jsp
    I am getting below exception while doing it.
    org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP:
    An error occurred at line: 32 in the jsp file: /apps/mywebsite/components/customFormAction/post.POST.jsp
    The method test() is undefined for the type DatasourceUtil
    29:          
    30:           ///
    31:          com.day.test.datasource.DatasourceUtil dsUtil = new com.day.test.datasource.DatasourceUtilImpl();
    32:          dsUtil.test();
    33:           //dsUtil.validateLogin(request.getParameter("username"), request.getParameter("password"));
    34:          
    35:           ////
    It appears to resolve the class correctly. I could run the code, if I only comment  dsUtil.test();. As soon as I uncomment, it gives above error.
    In the Utill I have a simple void method which will print a simple text. My package structure is as follows.
    any help will be great
    Tx

    1.  In the interface [1] not the implementation[2] have u defined the method test?
    2.  If it is implemented, Change the bundle version in bnd file and make a new build. Then from felix console verify the latest version reflected in the bundles.
    If 2 works & you are going to make lot of frequent changes then give the version as snapshot till it get stable.
    [1]  com.day.test.datasource.DatasourceUtil
    [2]   com.day.test.datasource.DatasourceUtilImpl

  • Identify Java version from CLASS file

    Hi,
    I have a .class file. I would like to identify the Java version from that.
    Is there a way to find out?
    Also, is there a way to find out the Java version from JAR file?
    Thanks.

    Kavipriya wrote:
    I have a .class file. I would like to identify the Java version from that.
    Is there a way to find out?Sure, there's the major version number (48, 49, 50) included in the class files. Look for the class file specification, shouldn't be too hard to find.

  • Have downloaded 10.9.4 but alert messages:This update requires OS X version 10.9. Where do I get this version from?

    Have downloaded 10.9.4 but alert messages:This update requires OS X version 10.9. Where do I get this version from?

    Ok..  your first post states you downloaded v10.9.4
    Are you trying to upgrade to Mavericks v10.9 ??
    If so, make sure your Mac meets v10.9 requirements >  OS X Mavericks: System Requirements
    iMac (Mid-2007 or later)
    MacBook (13-inch Aluminum, Late 2008), (13-inch, Early 2009 or later)
    MacBook Pro (13-inch, Mid-2009 or later),
    MacBook Pro (15-inch or 17-inch, Mid/Late 2007 or later)
    MacBook Air (Late 2008 or later)
    Mac mini (Early 2009 or later)
    Mac Pro (Early 2008 or later)
    Xserve (Early 2009)
    Your Mac also needs:
    OS X Mountain Lion, Lion, or Snow Leopard v10.6.8 already installed
    2 GB or more of memory
    8 GB or more of available space

  • Why passing string from applet to jsp doesn't work?

    Hi,all:
    I have a application requires applet to get client side info, then pass this "info"--string to the JSP.
    Applet code:
    try{
         URL url = new URL(getCodeBase(),"test.jsp?
    java.version=1.2.2&java.vendor=Sun);
         URLConnection conn = url.openConnection();
         conn.setDoOutput(true);
         conn.setUseCaches(false);
         conn.setRequestProperty("Content-Type", "application/octet-stream");
         conn.connect();
    } catch (Exception e) {
         System.out.println("The error is at URL:"+e.getMessage());
    My jsp code is:
    <%
    String java_version=request.getParameter("java.version");
    String java_vendor=request.getParameter("java.vendor");
    %>
    However, it doesn't work. Could anybody help me figure out?
    Thanks in advance.
    Paul

    Request Jsp with
    test.jsp?URLEncoder.encode("java.version")=URLEncoder.encode("java.version.value")&URLEncoder.encode("java.vendor")=
    URLEncoder.encode("java.vendor.value")

  • Can't get java to initiate applet, or even run, please help

    I need help, please. Need java to do some organic chem work, and I can't get it to work. I have Java 2 runtime SE - 1.4.1_05, virtual machine 1.4.1_05-b01, and plug-in the same as J2SE. The Web Start file was corrupted when it downloaded, so I removed it from the Add/Remove in control panel. I'm running windows 2000 Pro, I'm not a computer expert (means I need explicit instructions), I'm a vet student trying to do my homework, and study for exams. Any reply here will be very appreciated, or to my e mail [email protected] Thank you, Cindy

    There are plenty of people here that can and will help, but you need to tell us what the problem is (details, error messages, code samples, etc)
    Here's a general blurb, post back it it doesn't help.
    This may duplicate some of what you've already done, if so fine. But please verify you've done exactly what is written or know why you shouldn't before proceeding. You may want to print these instructions before continuing.
    Also note that this applies to the currrent java version installed on "standard" windows systems, only.
    To download the current version of Java, go here:
    http://java.sun.com/j2se/1.4.2/download.html
    and click on the word DOWNLOAD in the column labeled SDK in this line: Windows Offline installation (info)
    After downloading, click on this page of installation instructions and read through #6:
    http://java.sun.com/j2se/1.4.2/install-windows.html
    Install the software according to the preceeding instructions. If you encounter
    problems, see the section "Troubleshooting the Installation" in the installation instructions.
    Below is a Helloworld program, copy and paste it into your editor and save it as "HelloWorld.java" Use capitalization, Java is case-sensitive. If you're using Notepad, quote the name when saving, otherwise Notepad adds ".txt" to the name. Go to DOS/command window and check that you've got the file where you want it and that it's named correctly.
    -------save this program as HelloWorld.java--------
    public class HelloWorld {
    public static void main (String[] args) {
    System.out.println("Hello World!");
    In the same directory as HelloWorld.java, enter "javac" - the program should print out a list of options, if not, set your PATH - see below.
    In the same directory as HelloWorld.java, enter "javac HelloWorld.java" and the javac compiler will create HelloWorld.class. If it was successful it will not give any messages. Check that the file is created.
    In the same directory as HelloWorld.java, enter "java -classpath . HelloWorld" with the spaces and the period. The program will run. If it doesn't, recheck that you followed the instructions.
    Here is additional information:
    The Windows path is a set of pointers that Windows uses to locate programs that you execute, like javac.exe and java.exe. This setting is explained here:
    http://java.sun.com/j2se/1.4.2/install-windows.html - 5. Update the PATH variable
    (you should have already done this as part of the Java installation)
    The CLASSPATH is another set of pointers that is used by Java to find the files that you create and want compiled and/or run. This setting is explained here:
    Setting the Classpath:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html
    [NOTE: always start your classpath with ".;" which means the current directory. See my classpath, below]
    How Classes are Found:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/findingclasses.html
    Examples:
    This is my path
    PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\BATCH;C:\J2SDK1.4.2_01\BIN;C:\PROGRA~1\UTILIT~1;C:\PROGRA~1\WIN98RK
    This is my classpath
    CLASSPATH=.;C:\mjava;C:\mnrx;C:\NetRexx\lib\NetRexxC.jar;C:\j2sdk1.4.2_01\lib\tools.jar;C:\NetRexx\NrxRedBk

  • Can't get java runtime, and applets, running inside Firefox 11.

    I have gone to my Windows 7 control panel and enabled java for the mozilla family,
    which implies the web browser I use, Firefox 11 at the moment.
    I have gone to Firefox/Tools/Add-Ons/Plugins and have enabled the
    Java Deployment Kit 6.0.250.3
    However, when I go to the Oracle Java test page
    http://www.java.com/en/download/testjava.jsp
    It can't detect java working in my web browser.
    The install missing plugins button appears in the top right,
    and while it downloads java, it consistently fails here stating
    that I have the option to install manualy (which I have successfully done already).
    I have the java 6 download manager working, however I can't run applets embedded in the web browser.
    Please, how do I get my java working in firefox for my applets?

    Zachary1234 wrote:
    Yes, 32 bit java and a 32 bit web browser seem to be the only working answer for applets,
    even in windows 7 (and adherence to the firefox browser).No, its not. Its exactly as I said, not what you make of it. If you have a 64 bits firefox, install a 64 bits runtime.
    Let me put it differently: applets work just fine on my 64 bits Windows 7 under a 64 bits Firefox 11 with a 64 bits runtime.

  • Access two EAS with different Essbase versions and different java versions from the same p.c.

    Hi,
    I need to regularly access Essbase 11.1.2.2. and Essbase 11.1.2.3 EAS from the same client machine.
    They are on, and must be on, different versions of java, is there a way to have both versions of java installed but each using the correct version and without the two java versions causing any kind of problems?
    thanks,
    Robert.

    Hi Robert...  I assume this is web-launched?
    I spent a day or so trying understand the intricacies of the JNLP protocol and create shortcuts that will invoke web-launched EAS with the appropriate version of Java.  I can get one version of EAS to use the 1.6 Java Web Launcher, and the other version of EAS to use the 1.7 Java Web Launcher - but both Web Launchers eventually invoke the same version of Java!  There are switches in the JNLP syntax that seem like they should allow you choose the actual Java version that gets invoked, but I just could not make it work.
    You can use the Java Control Panel (in Control Panel) to enable and disable the relevant versions before launching EAS.
    If you find otherwise I would love to know (or if you find out how to control which versions are enabled or disabled via command-line script).

  • Get jdk version throgh applet

    hi
    how can i determine which jdk version the browser is using from applet.i want to tell the user that if he is using jdk1.4 version than a message appears that this applet can be run on jdk1.3 or less.
    Thanks

    Like I said,I am not a big applet maker but I would
    think this would cause a security exceptionI can't tell if this was a reply to my 2nd response, it seemed a little too quick. Anyway, if you didn't catch that, check here:
    http://java.sun.com/docs/books/tutorial/applet/practical/properties.html
    You can check the version with applets.

  • How to get Java Version of an application server using Function Module?

    Hi Friends,
    We are doing developments for system performance reporting for multiple BW Systems. For this purpose we need to get the JAVA Version for these multiple systems.
    If anyone tell us about any Function Module or Program that we can use to get this information?
    Thanks
    Nayan Joshi

    Hi,
    Calling an SAP Function Module from Java
    To call an SAP function module from a Java application, you first need SAP JCo (Java Connector); you can download it from SAP's site, though you need an account to do so.
    To actually open the connection, use the tip code shown here.
    Class jcoClass = Class.forName("com.sap.mw.jco.JCO", true, this.getClass().getClassLoader());
    Client client = JCO.createClient(clientNumber, user, passWord, lang, host, systemId);
    //all parameters are strings
    client.connect();
    Repository repository = new JCO.Repository("SAP", client);
    IFunctionTemplate functionTemplate = repository.getFunctionTemplate
    ("YOUR_FUNCTIONAL_MODULE_NAME");
    Function function = functionTemplate.getFunction();
    ParameterList parameterList = function.getImportParameterList();
    parameterList.setValue("value1", "INPUT_PARAM_NAME");
    parameterList.setValue("value2", "INPUT_PARAM_NAME2");
    client.execute(function);
    Regards,
    Marasa.

  • Java version from class file

    How to decide from class file that which java version (1.3, 1.4 etc) was used to compile it?

    Sorry I made a mistake,
    its minor, major
    Dont we have some utility given by Sun for this?
    javap -verbose <classname>will print out versions plus more...
    Do I need to use InputStream for reading class file then see the version?
    DataInputStream din = new DataInputStream(new FileInputStream(classFile));
    din.readInt();
    short minor = din.readShort();
    short major = din.readShort();Why do you need to do this?

  • Getting host name from applet

    Hi All,
    How can i get the local host name from applet ( Host name where the applet running) . While i tried with InetAddress i got only the loop back address 127.0.0.1. Can anyone help me out in this regard.
    Thanks in advance
    V.S.Saravanan

    When you say you tried the InetAddress, did you try the following?
    You could try creating a Socket connection back to the host/server URL from where the Applet was downloaded (you should have permission to do this). You can then get the local address of the Socket.
    Something like:
    String hostName = getCodeBase();
    Socket s = new Socket( hostName, portNum );
    InetAddress address = s.getLocalAddress();
    String hostName = address.getHostName();
    Eric

  • Get Java Version within programme...

    Hi, is it possible to retrieve the version of Java which is running from within a class?
    For example, I want to say:
    String javaVersion= // insert code here...
    System.out.println("This version of java is:"+javaVersion);
    Hope someone can help, thanks.

    Hi!
    This can be achieved with
    String javaVersion = System.getProperty("java.version");Also have a look at:
    http://java.sun.com/j2se/1.3/docs/api/java/lang/System.html#getProperties()
    Greez,
    deesze

  • Change java version from 6 to 5

    Is there quick way to change from 6 to 5 and back?
    The only way I've known from this forum - is with help of Add/Remove Programs
    Thank you!
    Edited by: stopper on Feb 22, 2008 11:20 AM

    Well, this technique has always worked for me. Right now I have JDK 1.6.0_04 installed on the D: drive, and JRE 1.6.0_03 installed in the usual way, including the copies of those .exe files in the System32 directory. With my PATH set up as shown above, here's how the commands work: C:\>java -version
    java version "1.6.0_04"
    Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
    Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
    C:\>C:\Windows\System32\java -version
    java version "1.6.0_03"
    Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
    Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing) I also have JDK 1.5 and 1.7 installed; when I want to test something under one of those, I use the fully qualified command: C:\>D:\Java\jdk1.7.0\bin\java -version
    java version "1.7.0-ea"
    Java(TM) SE Runtime Environment (build 1.7.0-ea-b19)
    Java HotSpot(TM) Client VM (build 1.7.0-ea-b19, mixed mode, sharing)

Maybe you are looking for

  • How can I use my ipod on a different computer

    The original computer I set my ipod up on no longer has internet access. How can i set up my ipod on another computer so I can download from itunes without having to delete all my songs?

  • Cannot connect to iTunes Store/App Store WHATSOEVER.

    Help! No matter what I do I can't connect to the App Store or iTunes. I've tried on my PC, iPod touch 2nd and 4th, iPad 2 and 3, but nothing works!! It always loads endlessly or until it times out. It's really strange because it used to work, but aro

  • How to sync pdf files in iBook on Mac to iBook on iPad/phone?

    I used to easily move pdf files I created on my Mac to my iPad by using iTunes to sync them as books.  But now books are separate from iTunes (as they should be), and iBooks doesn't sync my pdfs to my iPad.  I've done it using Dropbox as an intermedi

  • Problem filling item text in BAPI_PR_CREATE

    Hello guys,     I am using the bapi BAPI_PR_CREATE. I am having problems on filling up the text in the item level. I used the textID 'B04' the text will supposed to be in the 'material PO text' text field but it instead was placed in the 'item text'

  • Problem with creating Photo Book

    In the past when creating an iPhoto book if I dropped a Portrait photo into a Landscape frame, the frame changed to portrait. This option seems to be turned off now in the new version of iPhoto. I find I need to often change the shape of the frame an