Using a button of type=button to execute java code

Hello,
I here what I need to do.
- A user fill a form
- He press submit
- the button goes and execute some java code and then refresh the page (same page)
Now I don't want to use a input=Submit, that call a a servlet that just update the information, and output to the servlet;
     out.println("<html>");
      out.println("<body>");
      out.println("<head>");
      out.println("<meta content=\"1; url=" + "SamePage.jsp" + "\" http-equiv=refresh>");
      out.println("</head>");
      out.println("</body>");
      out.println("</html>");Instead, I would like to do: <INPUT TYPE="button" VALUE="Close Window"   onClick="window.close();"> but instead of JavaScript in the onClick it would be JavaCode that would update the object (already instantiated in the JSP) and would then refresh the page.
Is this possible?
thanks.

Hi,
it is not possible because JSP code is executed server-side, while javascript code is executed client-side (in client's browser).

Similar Messages

  • Execute Java Code on client

    Hello,
    how can i execute java code on clientside?

    I guess you will have to add an applet to the web page.
    http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/2/applet.html

  • Java.lang.NoClassDefFoundError when executing JAVA code

    Hy everyone,
    Trying to execute some java code through forms I got this error when running my program : java.lang.NoClassDefFoundError : simple (where simple is a java class I developped).
    These are the steps I followed:
    1- Devopping a simple JAVA class (simple.java) and compiling in JDK 1.4 (for compatibilty with forms 10.1.2.0.2)
    2- Creating the JAR file
    3- Copying the JAR file in <ORACLE_HOME>\forms\java
    4- Adding the adress of the JAR file in CLASSPATH (environment variable of the server)
    5- Adding the adress of the JAR file in CLASSPATH (environmental file of OAS default.env)
    6- Importing the JAVA class trought forms builder (program>>import java class)
    7- Invoking the JAVA class via the PL/SQL packages created by forms builder
    8- Running the program
    Thanks for your help.
    Regards.

    In most cases, you should not have to stop and restart OC4J_BI_FORMS to pick such changes. However, since you are having problems, I would ensure that all frmweb processes have been stopped, then stop and restart OC4J_BI_FORMS and retest. If that doesn't work, you should review how you imported the java into your app. Look closely at the Importer options you used and ensure that you have not change the file name at any point. Because you are working with Java, case sensitivity is critical.
    Also, where are you seeing the error message? Client java console or in a server side log? If server side, exactly which log file is reporting the problem? I would suggest you post the first 4 ro 5 lines of the error and not just the NoClassDefFound part.

  • Executing Java Code in ODI Procedure

    Hi All,
    I have following  java code which i need to write on ODI procedure but i am not sure which technology to chose (Jython,Sunopsis API or Java BeanShell).
    I tried to execute the procedure Jyhton with <% "Java code"%> but getting the error.Any boddy can suggest where i doing wrong.
    <%
    import javax.naming.Context;
    import javax.naming.NamingEnumeration;
    import javax.naming.directory.*;
    import java.util.Hashtable;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    String userName = "HXXXXXX";
    String CN1=null;
    String Dis_Name=null;
    String Mem_of=null;
    String Mail=null;
    String SGID=null;
    File file = new File("C:/Project/ODI/LDAPID.txt");
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, "LDAP://XX.if.YYYY.net:389/OU=XYZ,DC=ZZ,DC=if,DC=XYZ,DC=COM");
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    env.put(Context.SECURITY_PRINCIPAL, new String("" + "\\" + userName));
    env.put(Context.SECURITY_CREDENTIALS, "");
    DirContext ctx = null;
    NamingEnumeration results = null;
    ctx = new InitialDirContext(env);
    SearchControls controls = new SearchControls();
    controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
    results = ctx.search("", "(objectclass=person)", controls);
    FileWriter fw = new FileWriter(file.getAbsoluteFile());
    BufferedWriter bw = new BufferedWriter(fw);
       while (results.hasMore())
             SearchResult searchResult = (SearchResult) results.next();
             Attributes attributes = searchResult.getAttributes();
             Attribute attr = attributes.get("cn");
             String cn = (String) attr.get();
             CN1=(String.valueOf(attributes.get("cn")));
             Dis_Name=(String.valueOf(attributes.get("displayName")));
             SGID=(String.valueOf(attributes.get("userPrincipalName")));
             Mem_of=(String.valueOf(attributes.get("memberOf")));
             Mail=(String.valueOf(attributes.get("mail")));
             bw.write(CN1 + " || " + Dis_Name + " || " + SGID + " || " + Mail);
             bw.newLine();
    bw.close();
    results.close();
    ctx.close();
    %>
    I am getting following error.
    The application script threw an exception: java.lang.NullPointerException BSF info: CODE_JAVA at line: 0 column: columnNo
    Please suggest what went wrong with the code.
    Thanks
    Regards

    In Jython you don not need to declare the type so String userName = "HXXXXXX"; should simply read userName = "HXXXXXX" . Lots of your code need to be rewritten to work with Jython if you choose that as your technology.

  • Execute java code taken from a properties file

    I have a requirement to store some java code in the Properties file & use the code inside the program later. Is there a way I can execute this code after I get it from the .properties file which is retrieved using the ResourceBundle?
    Example:
    File: system.properties
    Item_list=blocksBean.menu(QueryValue,request.getContextPath())
    Inside my Java program I'm using this..
    theBody=codesBean.replaceAll(theBody, "%%menu%%",ResourceBundle.getBundle("system").getString("Item_list"), true);
    instead of
    theBody=codesBean.replaceAll(theBody, "%%menu%%",blocksBean.menu(QueryValue,request.getContextPath()), true);
    This doesn't work because ResourceBundle.getBundle("... returns the value.. which is a string "blocksBean.menu(QueryValue,request.getContextPath())". But what I need is it has to be executed..
    blocksBean.menu() returns a string value of html code fetched from the dartabase.
    Is there a way I can execute blocksBean.menu() which is retrieved from the .properties file.. If anyone has done it / have an idea on this.. please e-mail me [email protected]
    I need something like an eval() in javaScript..
    Thanks in advance
    -ashok

    These boys might have something that will help you:
    http://www.beanshell.org/
    Good luck
    Lee

  • Execute java code before rendering the page

    Hi,
    In a task flow, can I execute some java code before the page/view is rendered (i.e. some preprocessing). I would need to be able to have access to the bindings on the page.
    Thanks!

    Can you try doing as specified below:
    If it is simple JSPX, you could use the phase listener as follows:
    JSPX Code:
    <f:view beforePhase="#{SamplePageBean.phaseListener}">
    <af:document id="d1">
    <af:form id="f1">
    <af:panelFormLayout id="pfl1">
    <f:facet name="footer"/>
    </af:panelFormLayout>
    </af:form>
    </af:document>
    </f:view>
    Bean Code:
    public class SamplePageBean {
    public SamplePageBean() {
    public void phaseListener(PhaseEvent phaseEvent) {
    if (phaseEvent.getPhaseId().equals(phaseEvent.getPhaseId().RENDER_RESPONSE)) {
    // DO NECESSARY INITIALIZATION
    Thanks,
    Navaneeth

  • Execute Java code after login

    Hi experts,
    I'd like to execute some Java code after a successful login. I guess I could write a custom login module or use a WD Java iView to do this but a "better" solution may exist.
    Regards,
    Pierre

    Customizing your login module is probably your best bet. As soon as you're user is authenticated, you can execute your custom Java code.
    From my experience, I have not seen an easier / cleaner way to capture that event.
    Regards,
    Tom

  • Convert strings to executable java code

    Hey,
    I'm not sure how easy or hard this is to accomplish, but I am looking for a way to take a string from a JTextField and use it as a control structure for an IF block.
    For example, the user inputs 'keyword=="test" || keyword=="test2"' I want to use it in an if block to control it.
    Is there a way to do this? I realize the java file is already compiled in a class, so the string would probably be incapable of doing such a thing.
    Any thoughts would be appreciated!

    Basically this is impossible, because Java is a compiled language, but there are ways around it.
    Actually the ways are all basically one way: use an interpreted language. You can embed one into Java. You can write your own, new language (it could be a small simple mini-language, for example one that only evaluates boolean expressions; this is easier than it sounds), or you can use one that already exists.
    There already is an interpreted language for Java. It's called BeanShell. Also I'm told that someone has written a javascript interpreter for Java, but I don't know the details.
    I'd suggest Googling for BeanShell. It sounds like the quickest, easiest solution.
    But be careful: letting users execute arbitrary code can be a huge security hole.

  • Batch file to execute java code

    Hi,
    I need to write a batch file to execute a sequence of java applications.
    The problem i face is in addition to the usual libraries I am also using certain jar files i downloaded like the mail interface etc.
    When i just compile a java code using a simple batch file giving the path of the compiler and the java code, it fails citing not knowing the location if the packages.
    could anyone please let me know what i need to do. Is there like a skeleton that i might find somewhere for this operation

    dexterity wrote:
    Hi,
    I need to write a batch file to execute a sequence of java applications.
    The problem i face is in addition to the usual libraries I am also using certain jar files i downloaded like the mail interface etc.
    When i just compile a java code using a simple batch file giving the path of the compiler and the java code, it fails citing not knowing the location if the packages.
    could anyone please let me know what i need to do. Is there like a skeleton that i might find somewhere for this operationSet the classpath correctly at runtime.
    Why do you need the location of your compiler? Are you compiling or running? If you are compiling go look at Ant.

  • Class compiling/executing JAVA-Code??

    Hi!
    Stupid question: ;-)
    Is there a possibility to "parse" Java-Code into a JAVA-Class or to give JAVA-Code to a class that compiles the code and execute it?
    Thanks for answering!
    Mark Hauchwitz.

    background: we're running servlets and simply need to "parse" specialized/customized java-code for every customer into the servlet code. Source: database or whatever...
    How to get started?

  • Error when executing Java code, java.lang.NoClassFoundError:

    Hi, I am new learner in Java Programming and I am using J2SDK and notepad to write a code. I don't have problem in compiling using javac filename, however I received an error when executing using java filename.
    The error message I got is Exception in thread "main" java.lang.NoClassDefFoundError: Hello/jawa.
    I have verified this simple code - Hello has no issue but somehow it does not run. I even try to compile and execute in other computer also the similiar error returned.
    My Client Platform is Windows XP Professional.
    I would appreciate any expert can help to suggest me the knowledge/solution to fix this kind of error. Thanks
    Jackie

    It looks like you entered the command "java Hello.java" or "java Hello/java" (I assumed 'jawa' was a typo.)
    You should have entered "java Hello" if your class name is Hello. I am guessing that Hello.java is probably the source code file name. The argument to the java command is the fully qualified class name. "java Hello.java" tells the java command to look for a class named java that is in the Hello package.

  • How to: Transform Activity: Read global/local variable, execute java code

    Could anyone please show me how to do that???

    could you please elaborate your usecase? yes you can read global variable using getVariableData( ) xpath function and pass them as an argument to the processXSLT ( ) xpath function.
    You can read the global or local variables inside java exec using, please refer samples/references/javaexec sample.

  • Use of PL/SQL %TYPE and HS

    I have been unable to get a PL/SQL package specification to compile that uses %TYPE against a table that is referenced via a HS link and physically resides in MSSQL 7.
    The documentation I looked at (Oracle Transparent Gateway A82868-01 for 8.1.6 and A88789-01 for 9.0.1) does not specifically state if this functionality is supported or not. My database level is 8.1.7.1.5.
    I assume that if this is supported then Oracle does some translation of data types at compile time. If it is not suppported then I can remove the use of %TYPE and type the variables using the Raw data type.
    My line of code in the package spec is:
    PROCEDURE RFQ_HDR_OUT
    ( i_rfqnum IN "rfq"."rfqnum"%TYPE);
    I have also tried:
    PROCEDURE RFQ_HDR_OUT
    ( i_rfqnum IN rfq.rfqnum%TYPE);
    PROCEDURE RFQ_HDR_OUT
    ( i_rfqnum IN "dbo"."rfq"."rfqnum"%TYPE);
    PROCEDURE RFQ_HDR_OUT
    ( i_rfqnum IN rfq."rfqnum"%TYPE);
    The error I get is:
    (1): PLS-00201: identifier 'rfq.rfqnum' must be declared
    The rfq reference is actually a Oracle VIEW built on a SELECT * FROM table@HSODBC. I can successfully select data from this table using SQL*Plus.
    I am also able to reference this table in my package BODY without a problem.
    Any insight much appreciated.
    Regards, Charles.

    The compilation of the package does not create any trace output.
    My trace settings in hs\admin\inithsodbc.ora are:
    # HS init parameters
    HS_FDS_CONNECT_INFO=mssql
    HS_FDS_TRACE_LEVEL = 4
    HS_FDS_TRACE_FILE_NAME = hsodbc.trc
    I can however successfully run a SELECT against the same VIEW that I am trying to use for %TYPE in my package. This SELECT renders the following trace:
    TUESDAY MAY 14 2002 15:33:12.031
    (0) hoagprd(2); Entered.
    (0) [Generic Connectivity Using ODBC] version: 2.0.4.0.0010
    (0) connect string is:
    (0) YEAR2000_POLICY=-1;CTL_DEBUG=T;CONSUMER_API=1;SESSION_BEHAVIOR_FLAGS=4;PARSER_-
    (0) DEPTH=2000;EXEC_FLAGS = 131080;defTdpName=hsodbc;binding=(hsodbc,ODBC,"mssql");
    (0) ORACLE GENERIC GATEWAY Log File Started at 14-May-02 15:33:12
    (0) Class version: 65
    (0) hoagprd(2); Exited with retcode = 0.
    (0) hoainit(3); Entered.
    (0) hoainit(3); Exited with retcode = 0.
    (0) hoalgon(7); Entered. name = maximo.
    (0) Created new ODBC connection (27792120)
    (0) hoalgon(7); Exited with retcode = 0.
    (0) hoaulcp(4); Entered.
    (0) hoaulcp(4); Exited with retcode = 0.
    (0) hoauldt(5); Entered.
    (0) hoauldt(5); Exited with retcode = 0.
    (0) hoabegn(9); Entered. formatID = 306206, hoagttid =BATT.d2ea68f8.3.1.11,
    (0) hoagtbid = , tflag = 0, initial = 1
    (0) hoabegn(9); Exited with retcode = 0.
    (0) hoapars(15); Entered. stmtType = 0, id = 1.
    (0) nvOUT (P:\Src\QP\QP_SQTXT.C 55): SELECT * FROM "RFQ"
    (0) odbc_rec: select * from "RFQ"
    (0) nvOUT (P:\Src\QP\QPT2SEXE.C 929):
    (0) SELECT "T0000"."buyercompany" AS c00039, "T0000"."printdate" AS c00038, "T0000"."ldkey" AS c00037, "T0000"."rfq10" AS c00036, "T0000"."rfq9" AS c00035, "T0000"."rfq8" AS c00034, "T0000"."rfq7" AS c00033, "T0000"."rfq6" AS c00032, "T0000"."rfq5" AS c00031, "T0000"."rfq4" AS c00030, "T0000"."rfq3" AS c00029, "T0000"."rfq2" AS c00028, "T0000"."rfq1" AS c00027, "T0000"."historyflag" AS c00026, "T0000"."priority" AS c00025, "T0000"."changedate" AS c00024, "T0000"."changeby" AS c00023, "T0000"."paymentterms" AS c00022, "T0000"."shipvia" AS c00021, "T0000"."freightterms" AS c00020, "T0000"."fob" AS c00019, "T0000"."replytoattn" AS c00018, "T0000"."replyto" AS c00017, "T0000"."billtoattn" AS c00016, "T0000"."billto" AS c00015, "T0000"."shiptoattn" AS c00014, "T0000"."shipto" AS c00013, "T0000"."requestedby" AS c00012, "T0000"."requireddate" AS c00011, "T0000"."rfqtype" AS c00010, "T0000"."purchaseagent" AS c0009, "T0000"."closeondate" AS c0008, "T0000"."replydate" AS c0007, "T0000"."enterby" AS c0006, "T0000"."enterdate" AS c0005, "T0000"."statusdate" AS c0004, "T0000"."status" AS c0003, "T0000"."description" AS c0002, "T0000"."rfqnum" AS c0001, "T0000"."rowstamp" AS c0000 FROM "RFQ" T0000
    (0) nvOUT (P:\Src\QP\QPT2SEXE.C 932):
    (0) <<<<<<<<<<<<<<<<<<< Execution Strategy Begin <<<<<<<<<<<<<<<<<<<<<<<<<<<<
    (0) Original SQL:
    (0) SELECT * FROM "RFQ"
    (0)
    (0)
    (0) Accessing Database "hsodbc" with SQL:
    (0) SELECT "T0000"."buyercompany" AS c00039, "T0000"."printdate" AS c00038, "T0000"."ldkey" AS c00037, "T0000"."rfq10" AS c00036, "T0000"."rfq9" AS c00035, "T0000"."rfq8" AS c00034, "T0000"."rfq7" AS c00033, "T0000"."rfq6" AS c00032, "T0000"."rfq5" AS c00031, "T0000"."rfq4" AS c00030, "T0000"."rfq3" AS c00029, "T0000"."rfq2" AS c00028, "T0000"."rfq1" AS c00027, "T0000"."historyflag" AS c00026, "T0000"."priority" AS c00025, "T0000"."changedate" AS c00024, "T0000"."changeby" AS c00023, "T0000"."paymentterms" AS c00022, "T0000"."shipvia" AS c00021, "T0000"."freightterms" AS c00020, "T0000"."fob" AS c00019, "T0000"."replytoattn" AS c00018, "T0000"."replyto" AS c00017, "T0000"."billtoattn" AS c00016, "T0000"."billto" AS c00015, "T0000"."shiptoattn" AS c00014, "T0000"."shipto" AS c00013, "T0000"."requestedby" AS c00012, "T0000"."requireddate" AS c00011, "T0000"."rfqtype" AS c00010, "T0000"."purchaseagent" AS c0009, "T0000"."closeondate" AS c0008, "T0000"."replydate" AS c0007, "T0000"."enterby" AS c0006, "T0000"."enterdate" AS c0005, "T0000"."statusdate" AS c0004, "T0000"."status" AS c0003, "T0000"."description" AS c0002, "T0000"."rfqnum" AS c0001, "T0000"."rowstamp" AS c0000 FROM "RFQ" T0000
    (0)
    (0)
    Execution Strategy End >>>>>>>>>>>>>>>>>>>>>>>>>>>>(0) hoapars(15); Exited with retcode = 0.
    (0) hoaopen(19); Entered. id = 1.
    (0) hoaopen(19); Exited with retcode = 0.
    (0) hoadscr(16); Entered. id = 1.
    (0) hoastmt(195); Array fetch size is: 1.
    (0) ------ hoadscr() -------:
    (0) hoadamsz: 40, hoadasiz: 40, hoadambr: 1, hoadabrc: 1
    (0) row 0 - hoadambl: 0, hoadadty: 0, hoadaprc: 0, hoadacst: 0
    (0) row 0 - hoadascl: 0, hoadanul: 0, hoadanml: 8, hoadanam: rowstamp, hoadabfl:
    (0) 0, hoadamod: 0
    (0) row 1 - hoadambl: 8, hoadadty: 108, hoadaprc: 8, hoadacst: 0
    (0) row 1 - hoadascl: 0, hoadanul: 0, hoadanml: 6, hoadanam: rfqnum, hoadabfl: 8,
    (0) hoadamod: 0
    (0) row 2 - hoadambl: 50, hoadadty: 108, hoadaprc: 50, hoadacst: 0
    (0) row 2 - hoadascl: 0, hoadanul: 1, hoadanml: 11, hoadanam: description,
    (0) hoadabfl: 50, hoadamod: 0
    (0) row 3 - hoadambl: 6, hoadadty: 108, hoadaprc: 6, hoadacst: 0
    (0) row 3 - hoadascl: 0, hoadanul: 0, hoadanml: 6, hoadanam: status, hoadabfl: 6,
    (0) hoadamod: 0
    (0) row 4 - hoadambl: 7, hoadadty: 167, hoadaprc: 0, hoadacst: 0
    (0) row 4 - hoadascl: 0, hoadanul: 0, hoadanml: 10, hoadanam: statusdate,
    (0) hoadabfl: 7, hoadamod: 0
    (0) row 5 - hoadambl: 7, hoadadty: 167, hoadaprc: 0, hoadacst: 0
    (0) row 5 - hoadascl: 0, hoadanul: 1, hoadanml: 9, hoadanam: enterdate, hoadabfl:
    (0) apiutil; row 39 - cbDataOffset: 839, dwBinding: 1, width: 18, scale: 0
    (0) hoaftch(21); Exited with retcode = 1403, hoadabrc = 0.
    (0) hoaclse(22); Entered. id = 1.
    (0) hoaclse(22); Exited with retcode = 0.
    (0) hoadafr(23); Entered. id = 1.
    (0) hoadafr(23); Exited with retcode = 0.
    (0) hoacomm(11); Entered. keepinfo = FALSE, tflag = 1.
    (0) hoacomm(11); Exited with retcode = 0.
    Regards, Charles.

  • Error while executing java stored procedure from a pl/sql procedure

    We have a requirement where we need to execute JAVA code stored in an Oracle database (Java Stored Procedure). This code uses some JAR files which we have already loaded without any errors in the database.
    The class file was also loaded in the database without any errors. But when we execute the method of this class (JAVA code), it gives the following error:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.NoClassDefFoundError
    Is there any way of debugging the code and getting to know where exactly the problem is? Or, any tool/software available for doing the same.
    Any pointers would be of great help!
    Thanks in advance

    Hi Uday,
    My guess is that there is a problem with your java stored procedure that is causing the "ExceptionInInitializer" error to be thrown. According to the javadoc:
    is thrown to indicate that an exception occurred during
    evaluation of a static initializer or
    the initializer for a static variable
    Since I didn't see any of your code in your post, I can't help you much more, I'm afraid. Perhaps if you would provide some more details, I may be able to help you some more. I think the following details would be helpful:
    1. Complete error message and stack trace you are getting.
    2. The section of your java code that you think is causing the problem.
    3. Oracle database version you are using.
    Good Luck,
    Avi.

  • How to execute a custom java code from the process

    Hi All,
    I'm writing a process to generate the PDF and it works fine. Now, at the end or in the middle of the process, i would like to execute/write a java code then it will be invoked when the process running. Assume not using web service, is there another way? samples how to write custom code?
    Thanks,

    The Execute Script service allows you to execute java code on a particular step.
    A more robust solution would be to create a custom component for your custom code.
    Jasmin

Maybe you are looking for

  • How can i get my music from my itunes onto my mac itunes

    is there a way where i can get my music from my old pc's onto my macbook pro itunes?

  • Branch wise sales analysis report

    Hi Client wants to see sales analysis report branch wise. How to do so? Thanks

  • 1st generation G5 IMac OS

    My G5 20" Imac, first generation, with a new hard drive checks out as a working machine, but--: I do not have the disks for the original operating system, it was probably some version of 10.3. I am not able to start the machine with available OS disk

  • Block function showing differnt from QI06 to QI03 tocde

    Hi, Providing below is my requirement: I am using SAP ECC 6.0 In QI06 Tcode (QM Releases: Mass maintenance) selection screen I am providing Plant = "XXXX" and in "Change" tab under "Block" section providing value to Block Function = "Qualified" and c

  • Account determination for condition type

    Hi Guru, I have  requirement where I  need to assign G/l account in VKOA for condition type used for discount and markup same time. I know I can aasign trade discount to this condition type but how about markup. can we assign two diffeent account to