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

Similar Messages

  • 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 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 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

  • 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).

  • 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.

  • 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?

  • Update the result to client (JAVA code) aftere completing the user task

    Hi All,
    I have a simple workflow activity with in my BPEL process .
    FLOW is like this:
    1)----->Initiate/Process
    2)----->Workflow user task
    3)Approve/Reject /Others
    4)If APPROVE a call to web-service method
    5)reply
    If i got the out put as approve the next step is a call to web-service which should give the output to client(JAVA code).
    Is the above senario possible through BPEL.
    Thanks,
    Kalyan.

    HI ALL
    I fixed this problem. Problem was because of classpath. After setting the path of class file in classpath, issue was fixed.
    Regards
    Arun

  • 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.

  • 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.

  • Program Doesn't Execute The Code After PrinterJob Is Exectued?

    hi all
    i have two textfields textfield1,textfield2
    and i overrided focuslost for textfield1 to execute a for loop
    when i press the button printable_window it shows a frame to be printed
    when i press the Print This Window button the PrinterJob is executed,press cancel
    and back to the textfield1 and press tab,so the focuslost must be invoked right? but it's not and the for loop won't be executed???
    any ideas why this happens?
    here's my code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.print.*;
    class PrintUIWindow implements Printable, ActionListener {
        JFrame frameToPrint;
        static  JFrame f;
        static JButton printable_window;
        public int print(Graphics g, PageFormat pf, int page) throws
                                                            PrinterException {
            if (page > 0) {
                return NO_SUCH_PAGE;
            Graphics2D g2d = (Graphics2D)g;
            g2d.translate(pf.getImageableX(), pf.getImageableY());
            frameToPrint.printAll(g);
            return PAGE_EXISTS;
        public void actionPerformed(ActionEvent e) {
             f.dispose();
             printable_window.setEnabled(true);
             PrinterJob job = PrinterJob.getPrinterJob();
             job.setPrintable(this);
             boolean ok = job.printDialog();
             if (ok) {
                 try {
                      job.print();
                 } catch (PrinterException ex) {
                  /* The job did not successfully complete */
        public PrintUIWindow(JFrame f) {
            frameToPrint = f;
        public static void main(String args[]) {
            UIManager.put("swing.boldMetal", Boolean.FALSE);
            f = new JFrame("Print UI Example");
            f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            JFrame f2=new JFrame("Test Frame");
            printable_window=new JButton("printable_window");
            final JTextField textfield1=new JTextField("ID");
            final JTextField textfield2=new JTextField("Password");
            f2.getRootPane().setDefaultButton(printable_window);
            f2.setSize(250,100);
            f2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f2.setLayout(new FlowLayout());
            f2.add(textfield1);f2.add(textfield2);f2.add(printable_window);
            f2.setLocationRelativeTo(null);
            f2.setVisible(true);
            f.addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent e) {printable_window.setEnabled(true);}
            JTextArea text = new JTextArea(50, 20);
            for (int i=1;i<=50;i++) {
                text.append("Line " + i + "\n");
            JScrollPane pane = new JScrollPane(text);
            pane.setPreferredSize(new Dimension(250,200));
            f.add("Center", pane);
            JButton printButton = new JButton("Print This Window");
            printButton.addActionListener(new PrintUIWindow(f));
            f.add("South", printButton);
            f.pack();
            f.setLocationRelativeTo(null);
            printable_window.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
            textfield2.setText("");
            printable_window.setEnabled(false);
            f.setVisible(true);
            textfield1.addFocusListener(new FocusAdapter(){
            public void focusLost(FocusEvent e){
            for(int i=1;i<6;i++)
                System.out.println("Loop"+i);
    }

    iam_new2 wrote:
    any help here?Swing questions should be asked in the [Swing forum|http://forums.sun.com/forum.jspa?forumID=57]
    Kaj

  • 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.

  • How can I still be able to execute some codes after user press Ctr-C

    When user press Ctr-C to exit my program, I want to do something before the program terminated, how can I do that?
    Thanks for help.

    BOOL CtrlHandler(DWORD fdwCtrlType)
    switch (fdwCtrlType)
    // Handle the CTRL+C signal.
    case CTRL_C_EVENT:
    Beep(1000, 1000);
    return TRUE;
    default:
    return FALSE;
    * Class: alexiworld_yahoo_com_CtrlCHanler
    * Method: init
    * Signature: (V)V
    JNIEXPORT void JNICALL Java_alexiworld_yahoo_com_CtrlCHanler_init
    (JNIEnv *env, jobject this)
         SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE);
    }

Maybe you are looking for