Values from Java Applet - Html

Does anyone know a quick, effective way to export field values in java to an HTML form? Thanks. Charles

You could use reflection: thsi would allow you to get the list of all the fields in an object you hold.
For example say you have a servlet ExportValuesServlet and you want it to output the field values of object publishedObject.
No matter what type publishedObject is, you could try, in the doGet method of ExportValuesServlet:
import java.lang.reflect.*;
doGet() { ....
PrintWriter out = new PrintWriter (response.getOutputStream());
try {
Class class = publishedObject.getClass();
Field fields = class.getFields();
for (int=0; i<fields.length; i++) {
Object value = fields.get(publishedObject);
out.println(fields[i].getName() + "= " + value.toString());
catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace(System.err);

Similar Messages

  • How to get return value from java and read by other application?

    i want to read return value from java and the other application read it.
    for example:
    public class test_return {
        test_return(){
        public int check(){
            return 1;
        public static void main(String args[]){
           new test_return().check();
    }from that class i make as jar file. How to read the return value (1) by other application?
    thx..

    If your installer is requiring some process it invokes to return a particular value on failure, then the installer is seriously broken. There are a bazillion commands your installer could invoke, and any of them could fail, which in turn could invalidate the entire install process, and any of them could return any value on failure. The only value that's consistent (in my experience) is that zero means success and non-zero means failure, with specific non-zero values being different in different programs.
    About the only control you have over the JVM's exit code is that if your main method completes without throwing an exception, the JVM will have an exit code of 0, and if main throws an exception (either explicitly or by not catching one thrown from below), it will be non-zero. I'm not even sure if that's guaranteed, but I would guess that's the case.
    EDIT: I'm kind of full of crap here. If you're writing the Java code, you can call System.exit(whatever). But nonetheless, if your installer requires certain exit codes from any app--java or otherwise--you have a problem.
    Edited by: jverd on Oct 29, 2009 1:27 AM

  • Pass value from Java to Perl

    Anyone knows how to pass value from Java to Perl program?

    Did you write the perl program? Can you change it? Or are you trying to interface to something that already exists? This will limit your options, of course.
    Anyway the first option is simple. The java program does this:
    System.out.println("This is a line of input.");The perl program does this:
    while(<>)and in that block, $_ is assigned to each line of input.
    Then you can invoke both like this:
    $ java MyJavaProgram | perl MyPerlProgram.pl

  • How to change a date value from "java.util.Date" to "java.sql.Date"?

    Hi all,
    How to change a date value from "java.util.Date" to "java.sql.Date"?
    I m still confusing what's the difference between them.....
    thanks
    Regards,
    Kin

    Thanks
    but my sql statement can only accept the format (yyyy-MM-dd)
    such as "select * from xx where somedate = '2004-12-31'
    but when i show it to screen, i want to show it as dd-MM-yyyy
    I m using the following to change the jave.util.Date to str and vice versa. But it cannot shows the dd-MM-yyyy. I tried to change the format from yyyy-MM-dd to dd-MM-yyyy, it shows the wrong date in my application.
         public String date2str(java.util.Date thisdate)     {
              if (thisdate != null)     {
                   java.sql.Date thissDate = new java.sql.Date(thisdate.getTime());
                   return date2str(thissDate);
              }     else     {
                   return "";
         public String date2str(java.sql.Date thisdate)     {
              if (thisdate != null)     {
                   SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                   return sdf.format(thisdate);
              }     else     {
                   return "";
         public java.util.Date str2date(String thisdate)     {
              String dateFormat = "yyyy-MM-dd"; // = 1998-12-31
              java.util.Date returndate = null;
              if (thisdate != null)     {
                   SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormat);
                   try {
                        returndate = dateFormatter.parse(thisdate);
                   } catch (ParseException pe) {
                        System.out.println (pe.getMessage());
              return returndate;
         }

  • Putting attribute value from java level into sessionScope variable?

    Hallo,
    is it possible to put an attribute value from java level into a sessionScope variable?
    For example when i'am in prepareSession is it possible to fill a sessionScope variable which i can use in a jspx-Site? And when how i must do it?
    Any help is appreciated.

    At the java level i make this
    private void setUserIdIntoUserDataHashtable() {
    Integer userid = getUserIdForLoggedInUser();
    Integer groupid = getGroupIdForLoggedInUser();
    Hashtable userdata = getDBTransaction().getSession().getUserData();
    if (userdata == null){
    userdata = new Hashtable();
    userdata.put(PBConstants.CURRENT_USER_ID, userid);
    userdata.put(PBConstants.CURRENT_GROUP_ID, groupid);
    And when i at the java level i can use the constants. But i don't have an interaction at this point. Thats why i don't now how to bring the values to a sessionScope variable i need later in a / some sites?

  • Please help!!  Where I can find free Java-applet HTML-Editor???

    I need free Java-applet HTML-Editor. Where I can find it????
    Thanks.

    NetBeans or Forte is supposed to do that now. I've not had an occasion to try to do it in either yet though.

  • How to pass the value from JSP or HTML  to Applet

    Plz reply ....How can we pass the value from the JSP Page or from HTML page to Applet embedded in same 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.

  • Read, Write and create files from java applet.

    Dear All,
    I have created a two files. One is applet and one application file. I am creating a instance of application file in applet. Application file is used for reading, writing and creating files. When I invoke applet from broser it dipslays error wrt file access permission. From the forum search I know that we need to sign the applet / edit the java policy to run the code locally. Final delivery of my code should execute on different system. Its not web. I have created a html page on submitting the form it invokes applet to read the form values from param and needs to update the values in xml file located locally. Please help me on how I can proceed with this fix.
    Thanks in advance.

    Sorry if I have not stated the problem clearly. I need to update content to files hosted in local system using java applets.
    I belive there are two ways to achive that.One with jar signer and one with modifying the java policy file. But this application needs to be installed in different system locally as I have created a application with webpage as useinterface and need to update the content in local files on submission. Not sure on how to modify the java.policy files in each end user system and whats the value we need to update in java policy file. Please help me on the steps to be followed

  • Parameter passing from java applet

    Hi all.
    currently i'm trying to create online testing applet (like TOEFL exam) for fun.
    i've create basic testing rutine, but i got stuck on showing the results.
    i want to show the results on the HTML so that users can print it out easily. but i donw know how to pass parameter from Java to some other language.
    I've searched for JavaScript, but it seems that it's only possible when using NetScape. Also, I searched for PHP, but it's just not possible. HTML seems that it's only possible from "HTML to Java"...
    if anyone knows how i can do it, and which language i should use, please let me know.
    thanx!

    i want to print out the questions that user have mistaken. print out the question, wrong answer, and right answer.
    all the answers are created by radiobutton so i want to get the only the Strig values, which wouldn' be so difficult.
    I've searched about JSObject, but could u tell me where can i install the package (or SDK)?
    And do users need to install the package as well?
    thanks for your time.

  • Calling a WebService from Java Applet

    Hi all,
    In my application I have 3 projects:
    1. server - for all the business logic.
    2. view - for web app.
    3. swing - for applet.
    In the view project I wrote a WS, and I want to call it from my applet. So I created a WS using the Jdev (10.1.3.2) wizard in the view project (I tested it and it worked fine), and in the swing project I created a proxy for this WS, tested it and it worked fine. Then I created a JAR containing the swing project with the WS proxy classes, opened the Applet and find out that I have some classes missing, so I started adding all the relevant Jars and ended with a ~13MB JAR containing all the swing project jars that in the class path for a simple Applet.
    I know that I'm missing something but I dont know what. Do I really need all those Jars. Is there a simple way to call to a WS via Applet?
    This is the list of all the Jars:
    activation.jar
    commons-logging-api.jar
    commons-logging.jar
    ejb.jar
    http_client.jar
    jaxb-api.jar
    jaxb-impl.jar
    jaxen.jar
    jaxr-api.jar
    jaxrpc-api.jar
    jazncore.jar
    jdom.jar
    jms.jar
    jta.jar
    mail.jar
    mdds.jar
    oc4jclient.jar
    ojdl2.jar
    ojmisc.jar
    ojpse.jar
    oraclepki.jar
    orajaxr.jar
    orasaaj.jar
    orawsdl.jar
    orawsrm.jar
    osdt_cert.jar
    osdt_core.jar
    osdt_saml.jar
    osdt_wss.jar
    osdt_xmlsec.jar
    relaxngDatatype.jar
    saaj-api.jar
    saaj-impl.jar_old
    servlet.jar
    wsclient.jar
    wsdl.jar
    wssecurity.jar
    wsserver.jar
    xdb.jar
    xml.jar
    xmlparserv2.jar
    xsdlib.jar
    By the way at the end of all this annoying process I got the next exception:
    [failed to localize] typemapping.nested.exception.initialization(javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable to create SOAP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl not found)
         at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService.java:282)
         at oracle.j2ee.ws.client.BasicService.createStandardTypeMappingRegistry(BasicService.java:244)
         at com.tm.view.ws.misc.runtime.WSMisc_Service_SerializerRegistry.getRegistry(WSMisc_Service_SerializerRegistry.java:26)
         at com.tm.view.ws.misc.runtime.WSMisc_Service_Impl.<init>(WSMisc_Service_Impl.java:26)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:92)
         at oracle.j2ee.ws.client.ServiceFactoryImpl.loadService(ServiceFactoryImpl.java:121)
         at com.tm.view.ws.misc.WSMiscSoap12HttpPortClient.<init>(WSMiscSoap12HttpPortClient.java:20)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at client.base.connectivity.ClientRequestAgent.runWS(ClientRequestAgent.java:135)
         at client.base.connectivity.ClientRequestAgent.run(ClientRequestAgent.java:44)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Shachar

    Try this:
    1. open the webService data controll in the Data Controls section and drag the method from the webService onto the method call activity in your task flow. This will overwrite the current method property (the one which pints to your bean, make a copy of this entry if you can't reproduce it by hand). This too will create an entry in the pageDef of the method call activity.
    2. reenter (or paste) the original value in the method property, so that it again points to your bean. The entry in the pageDef will remain!
    3. now in the bean method you can access the method via its binding like you access any other method from the binding:
    // GET A METHOD FROM PAGEDEF AND EXECUTE IT
    // get the binding container
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    // get an Action or MethodAction
    OperationBinding method = bindings.getOperationBinding("YourMethodActionNAME");
    if (method == null)
    // handle method not found error...
    // if there are parameters to set...
    Map paramsMap = method.getParamsMap();
    paramsMap.put("param","value")  ;    
    // execute the method
    method.execute();
    List errors = method.getErrors();
    if (!errors.isEmpty())
       // handle errors here errors is a list of exceptions!
    // no error resume normal workTimo

  • How to move a money value from java to Flex

    According to
    http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDo cs_Parts&file=00001103.html
    I can pass a Double, Float, Long, Short, BigDecimal or the primative equivalent types from java to Flex and they will be converted into a number.
    My testcase says that only BigDecimal actually shows up on the Flex side.
    Am I missing something or is there a problem in BlazeDs/Flex somewhere?
    Bill Tims
    P.S. If you would like my sample code, I'll be glad to post it.

    Pete
    After looking at it I see why you were confused. Here is the Java object, the receiving Flex object, and the debug info from the SystemOut.log out of JBos 4.2. All of this is using Java 1.6 and Flex 3.0. I'm using the December, 2008 BlazeDs jar files.
    The variable bCd is being serialized as BCd. If I change it to bcd, everything works fine. We also tested this with php->flex and that works fine, which suggests the problem is in Blaze.
    public class Test2 implements Serializable{
    private static final long serialVersionUID = 1805176418478176484L;
    private String abc = "abc";
    private String bCd = "bcd";
    public Test2() {
    public String getAbc() {
    return abc;
    public void setAbc(String abc) {
    this.abc = abc;
    public String getBCd() {
    return bCd;
    public void setBCd(String cd) {
    bCd = cd;
    ============================================================
    package jdbcTables.businessdelegate {
    import mx.rpc.soap.types.*;
    import org.slsot.mis.jdbc.*;
    [RemoteClass(alias="org.slsot.mis.value.inquiry.Test2")]
    [Bindable]
    public class Test2
    public var abc:String;
    public var bCd:String;
    } /* Test2*/
    =============================================================
    12:24:22,084 INFO [STDOUT]-btims [BlazeDS]03/03/2009 12:24:22.084 [Endpoint.General] Channel endpoint slsot-amf received request.
    12:24:22,084 INFO [STDOUT]-btims [BlazeDS]03/03/2009 12:24:22.084 [Endpoint.AMF] Deserializing AMF/HTTP request
    Version: 3
    (Message #0 targetURI=null, responseURI=/4)
    (Array #0)
    [0] = (Typed Object #0 'flex.messaging.messages.RemotingMessage')
    operation = "callFunction"
    source = null
    destination = "accessor"
    timestamp = 0
    headers = (Object #1)
    DSEndpoint = "slsot-amf"
    DSId = "nil"
    clientId = null
    timeToLive = 0
    messageId = "9530B236-243F-4965-4252-CD944C3430F1"
    body = (Array #2)
    [0] = "Test"
    [1] = "test2"
    [2] = (Array #3)
    12:24:22,084 DEBUG [Accessor]-btims Begin Test.test2()
    12:24:22,099 DEBUG [Security]-btims t2=org.slsot.mis.value.inquiry.Test2@1b89df3
    12:24:24,678 DEBUG [Accessor]-btims End Test.test2()
    12:24:24,678 INFO [STDOUT]-btims [BlazeDS]03/03/2009 12:24:24.678 [Service.Remoting] Adapter 'java-object' called 'org.slsot.mis.Accessor.callFunction(java.util.Arrays$ArrayList (Collection size:3)
    [0] = Test
    [1] = test2
    [2] = java.lang.Object[] (Array length:0)
    12:24:24,693 INFO [STDOUT]-btims [BlazeDS]03/03/2009 12:24:24.693 [Service.Remoting] Result: 'org.slsot.mis.value.inquiry.Test2
    abc = abc
    BCd = bcd
    12:24:24,693 INFO [STDOUT]-btims [BlazeDS]03/03/2009 12:24:24.693 [Endpoint.AMF] Serializing AMF/HTTP response
    Version: 3
    (Message #0 targetURI=/4/onResult, responseURI=)
    (Externalizable Object #0 'DSK')
    (Typed Object #1 'org.slsot.mis.value.inquiry.Test2')
    abc = "abc"
    BCd = "bcd"
    1.236104664693E12
    (Byte Array #2, Length 16)
    (Byte Array #3, Length 16)
    (Byte Array #4, Length 16)

  • Javascript from Java - calling html control functions

    i have called the attributes of an html control from java using this method
    private JSObject iframeObject;
    iframeObject=(JSObject)win.eval("parent.document.getElementById('"+popupIFrame+"')");
    iframeObject.setMember("src", "../Applet/Popup.html");but how can i call the functions of a control
    for example the focus() function of a textbox or someother controls???

    its ok i got it.
    win.eval() can do it

  • Trouble creating jar from java applet in eclipse

    I have a java applet in eclipse which I can run, however, I need to be able to view the applet in IE, because certain pieces wont work when I run within eclipse. When I attempt to export the project to a jar it asks for a main class, which does not exist. Can someone please help as to how I can launch my applet from eclipse into IE, or how I can export it as a jar?
    Thanks!

    Don't you just use copy the class from your workspace and embed it in your HTML by pointing to it's new location. Eclipse only asks for the main class when exporting an executable Jar anyways. Why don't you just get the class and putting in your directory with your HTML?

  • Access Flash Player position from Java Applet

    Hallo Everybody,
    as a part of my diploma thesis, I have on a HTML Page two
    objects, one is a Flash Movie, streamed from a Flash Server, the
    other is a Java Applet. In the Java Applet I have a button "Get
    time of Movie". When the user clicks on this button, the Applet
    shoud ask the Flash Player about it's actual position (min, sec)
    and the Applet should get this information back. I think, with the
    ExternalInterface Class might it be possible, but I have no idea
    how. Could anybody help me?
    Thanks
    Beat

    Hi!
    I want to access from a java client application to an .Net WebService, can you help me with some code ???
    Thankz!

  • Calling perl from java applets

    I have problems in executing PERL from a JAVA applet and Swing interface.
    I'm working under Windows 98.
    My aim is the following:
    When I click on the "Analizza" button,
    I want to execute a PERL program and automatically
    close the DOS window after completion. If there
    is an error, this error should be displayed in DOS.
    I wrote this piece of code
    public void actionPerformed(ActionEvent eventoUtente){
         String comandoPulsante = eventoUtente.getActionCommand();
              if (comandoPulsante == "Analizza"){
              Runtime rt = Runtime.getRuntime();
              try{
              Process pr= rt.exec("cmd -c c:\\command /c perl C:\\_webasco\\contatutto2.pl");
              catch(java.io.IOException ioEx)
              System.out.println("IOEx:"+ioEx.getMessage());
    I tried also with a Windows executable, ie I replaced the line
         Process pr= rt.exec("cmd -c c:\\command /c perl C:\\_webasco\\contatutto2.pl");
    with
         Process pr= rt.exec("command /c c:\\windows\notepad.exe");
    but in both cases nothing happens within the applet.
    What am I doing wrong????
    Any suggestions is warmly welcomed.
    Thank you
    Marina

    I know nothing about Perl, but the line
    if (comandoPulsante == "Analizza"){
    compares references not values and will always return false. Try:
    if (comandoPulsante.equals("Analizza")) {

Maybe you are looking for

  • Browse and dispaly

    Hi, I am trying to create a gui where I can browse on my desktop and load a file from there to take it to the server. Below I have taken a snipet of the code where I browse on my desktop, but my problem is this is not displayed in the textfield...(an

  • Rendering imported images in Final Cut so they look nice

    I recently edited a video requiring still image animation, something Final Cut is notoriously poor at. After much experimenting, I got good results that I want to share. Hope it will help someone else. I have also posted this info, with pictures, her

  • Import Vendor Details

    Hello Experts, I m developing report for  imports vendor, in which i form document number from custom MIRO ,GRN (MIGO), MIRO  till final payment doc number . I m using function module AC_DOCUMENT_RECORD, but not getting docment number Plz sugget . Ra

  • How do i group my contacts?

    I have google + groups but don't know how to change a contact to an established group.

  • Assistance to setup file for DIF

    Hi Experts, We are having difficulty to do the correct setup in transaction file for DIF. Is it possible that someone can provide a few screenshots to show how the setup should look like for the logical file path definition, Assignment of Physical fi