How can we  use java variable in javascript code on JSP page?

How can we use java variable in javascript code on JSP page?
Pls help

Think about it:
JSP/Java is executed on the Server and produces HTML+JavaScript.
Then that HTML+JavaScript is transfered to the client. The client now interpretes the HTML+JavaScript.
Obviously there's no way to access a Java variable directly from JavaScript.
What you can do, however, is write out some JavaScript that creates a JavaScript variable containing the value of your Java variable.

Similar Messages

  • How can I access xml document from javascript whithin a JSP page

    how can I access xml document from javascript whithin a JSP page?
    I have a JSP that receives an XML document from a JavaBean, so I can access it within the entire JSP, but I need to access it from the javascript inside the JSP... and I have no idea how i can do this.
    Thanks in advance!

    The solution would only work on MS IE browsers, as other browsers do not support an XML DOM.
    It can be done, but you would be stuck with using the Microsoft broswer. If that is acceptable, I have some example code, and a book recommendation.

  • How can I use environment variables in a controller?

    Hi all,
    How can I use environment variables in a controller?
    I want to pass a fully qualified directory and file name to FileInputStream and would like to do it by resolving an env variable, such as $APPLTMP.
    Is there a method somewhere that would resolve this??
    By the way,Did anyone used the class of "oracle.apps.fnd.cp.request.RemoteFile"?
    The following is the code.
    My EBS server is installed with 2 nodes(one for current,and other is for application and DB).I want to copy the current server's file to the application server's $APPLTMP directory. But the result of "mCtx.getEnvStore().getEnv("APPLTMP")" is current server's $APPLTMP directory.
    Can anyone help me on this?
    private String getURL()
    throws IOException
    File locC = null;
    File remC = new File(mPath);
    String lurl = null;
    CpUtil lUtil = new CpUtil();
    String exten;
    Connection lConn = mCtx.getJDBCConnection();
    ErrorStack lES = mCtx.getErrorStack();
    LogFile lLF = mCtx.getLogFile();
    String gwyuid = mCtx.getEnvStore().getEnv("GWYUID");
    String tmpDir = mCtx.getEnvStore().getEnv("APPLTMP");
    String twoTask = mCtx.getEnvStore().getEnv("TWO_TASK");
    // create temp file
    mLPath = lUtil.createTempFile("OF", exten, tmpDir);
    lUtil.logTempFile(mLPath, mLNode, mCtx);
    Thanks,
    binghao

    However within OAF on the application it doesn't.
    what doesnt work, do you get errors or nothing ?XX_TOP is defined in adovars.env only. Anywhere else this has to go?
    No, it is read from the adovars.env file only.Thanks
    Tapash

  • How can we use Session Variable in Answers or Analysis?

    How can we use Session Variable in Answers or Analysis?

    Again, duplicate cross-posting!
    See rukbat 's post here: Re: BI Apps 7.9.6.3(Agent Issue)

  • How can I use the Variable Delay VI (From DSP Module) to Deploy Variable Delay on Speddy-33

    Dears,
    I dont Understand How Can I Use the Variable Delay to Deploy Variable Delay on a Speedy-33 Kit

    Hello,
    Thank you for posting to the NI Forums!! You should be able to incorporate the Variable Delay.vi into your vi and then build as normal and the functionality of the vi should translate to the build. What type of build are you doing? Are you receiving any specific errors? Thanks!
    Regards,
    Margaret Barrett
    National Instruments
    Applications Engineer
    Digital Multimeters and LCR Meters

  • How can i use substitution variable

    Hai All
    This is my sql statement
    SELECT (TO_DATE(TO_CHAR(Intime,'DD-MON-YYYY')||' '||
    TO_CHAR(0815,'0000'),'DD-MON-YYYY HH24:MI')-intime) * 24*60
    from dail_att where to_char(intime,'hh24mi') between 0700 and 0815 ;
    Here my table name called Dailyattendance
    Intime field is declared as Date Type
    So now i have hardcoded 0815 and now my intime is subtracted from this time so i can calculate the employee
    coming late so how can i use substitution variable here to give the value at run time
    Ie i need to give 0815 instead or any other time at runtime
    Thanks In advance
    Srikkanth.M

    Where exactly are you planing to use it? Is sqlplus or at any other front end?
    One way is to use below given SQL
    SELECT   (  TO_DATE (   TO_CHAR (intime, 'DD-MON-YYYY')
                         || ' '
                         || TO_CHAR (:TIME_VAR, '0000'),
                         'DD-MON-YYYY HH24:MI'
              - intime
           * 24
           * 60
      FROM dail_att
    WHERE TO_CHAR (intime, 'hh24mi') BETWEEN 0700 AND 0815;*009*
    Edited by: 009 on Apr 6, 2010 2:15 AM

  • How Can I use a Variable  in Data Controls query. Frank Kindly check...

    Hii,
    I am using JDeveloper 11g ADF BC.
    My Requirement is that I hv a login screen which is taken from [http://blogs.oracle.com/shay/simpleJSFDBlogin.zip].
    I hv attached BC in this application. I want to use the login usercode in the next pages after login screen. Next screen contains 3 list items which will be populating based on the user. So I created <af:selectOneChoice> using the BC( Just drag & dropped the column into the page from the data controls). But in the data control i want to use this usercode for passing the condition. Now Data is coming without any condition.
    So How can I use the usercode in the Data controls query.
    When I tried to display the usercode in the next page it is showing by binding the value. its code is follows
    <af:outputText value="#{backing_getUser.uid}"
    The program for checking the username & Password is follows.
    package login.backing;
    import oracle.adf.view.rich.component.rich.RichDocument;
    import oracle.adf.view.rich.component.rich.RichForm;
    import oracle.adf.view.rich.component.rich.input.RichInputText;
    import oracle.adf.view.rich.component.rich.layout.RichPanelFormLayout;
    import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
    import java.sql.*;
    import java.util.List;
    import java.util.Map;
    import oracle.adf.view.rich.component.rich.output.RichMessage;
    import oracle.jdbc.OracleDriver;
    public class GetUser {
    private RichInputText uid;
    private RichInputText pid;
    private RichCommandButton commandButton1;
    private RichInputText inputText1;
    private RichInputText inputText2;
    public void setUid(RichInputText inputText1) {
    this.uid = inputText1;
    public void setPid(RichInputText inputText2) {
    this.pid = inputText2;
    public RichInputText getUid() {
    return uid;
    public RichInputText getPid() {
    return pid;
    public void setCommandButton1(RichCommandButton commandButton1) {
    this.commandButton1 = commandButton1;
    public RichCommandButton getCommandButton1() {
    return commandButton1;
    public String login_action() {
    // Add event code here...
    String user = this.getUid().getValue().toString();
    // String pass = inputText2.getValue().toString();
    String pid = this.getPid().getValue().toString();
    Connection conn;
    conn = getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery ("SELECT usercode FROM guser where usercode = '"+user.toUpperCase()+"' and pwd=F_TEST('"+pid.toUpperCase()+"')");
    if (rset.next()) {
    conn.close();
    return "good";
    conn.close();
    } catch (SQLException e) {
    System.out.println(e);
    return "bad";
    public static Connection getConnection() throws SQLException {
    String username = "ACCTS";
    String password = "ACCTS";
    String thinConn = "jdbc:oracle:thin:@SERVER1:1521:G5PS";
    DriverManager.registerDriver(new OracleDriver());
    Connection conn =
    DriverManager.getConnection(thinConn, username, password);
    conn.setAutoCommit(false);
    return conn;
    public void setInputText1(RichInputText inputText1) {
    this.inputText1 = inputText1;
    public RichInputText getInputText1() {
    return inputText1;
    public void setInputText2(RichInputText inputText2) {
    this.inputText2 = inputText2;
    public RichInputText getInputText2() {
    return inputText2;
    -----

    Hi,
    I didn't look at the example, but if you want to secure your application then you should use container managed security. Read this .
    Anyway, you could add this before return "good"; in your login_action()
    FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("username", user);Then, you can access this from anywhere in the application by using #{sessionScope.username}.
    Pedja

  • How can i use Java

    How can i use javabeans in forms?

    You need to Create your JavaBean.
    Then you need to run the "Oracle Forms PJC" Wizard which can be found at File | New .../Beans tab.
    This wizard generates the correct adapters to allow JavaBean properties/events to be propogated to / from the Forms environment.
    For more details, please search the Help system for PJC.
    -John

  • How can I get Java to fill out form on web page and submit?

    I need to write a Java program that will submit a HTML form. I tried using POST already, but the only response I got back was the source code for the page itself. Looking more closely, I realized that there is a PHP script that will actually take the data from the forms and use it. How can I get Java to enter the data on the forms automatically and then run this PHP script? I don't need code, just a pointer in the right direction should do.
    Thanks in advance,
    Hasitha D

    hasithad314 wrote:
    I need to write a Java program that will submit a HTML form. I tried using POST already, but the only response I got back was the source code for the page itself. Looking more closely, I realized that there is a PHP script that will actually take the data from the forms and use it. How can I get Java to enter the data on the forms automatically and then run this PHP script? I don't need code, just a pointer in the right direction should do.
    If you are writing a program to submit a form,how come the PHP script come out of nowhere ? At this momemnt you are just writing some Java program,isn;t it ?
    My feeling is you are trying to edit some pre-written code.
    Is it ?
    Thanks.

  • How can I use a pic from iPhoto as a background for a page, How can I use a pic as a background for a page

    How can I use a pic from iPhoto as a background for a page, How can I use a pic as a background for a page

    cd,
    Insert the picture and position it as you desire
    Make sure the picture is set to Floating in the Wrap Inspector
    Arrange > Send Objects to Background
    Regards,

  • How can I use Java to do Seismic programming as Motif?

    One of my friend recently finished a seismic on-site data processing program using
    Motif on Solaries.He asked me if I can implement the same function to use Java language
    so that the program can run on different platforms such as Windows,Unix.
    Seismic data is usually enormous.And I don't have any experence in plotting seismic
    curves by using Java.
    Is there any seismic processing software programmed with Java available?
    I will appriciate any help.
    Thank you

    I think the point is not the word seismic than 'how to plot curves in Java.'.
    You can find many resources about plotting curves you want in Java2D.
    Refer to these URL:
    Java2D http://java.sun.com/products/java-media/2D/index.html
    Java2D Tutorial http://java.sun.com/docs/books/tutorial/2d/index.html

  • How can I use local variable in LabVIEW-Action?

    Hi All!
    There is local variable (for example "MyVariable") in local scope of project. There is Action-step, created by LabVIEW. One of input terminals step is "Sequence Context".
    How can I access to MyVariable by Sequence Context? Unbundle? It does't work.
    Thank you.

    On the TestStand palette there is a VI called TestStand - Get Property Value.vi.  Use that.  Attached is an image showing how to use it.  The trick is making it produce the correct data type.  Do that by right clicking on the VI and selecting Select Type.  Then you can choose the type.  I think in LV 2010 and TS 2010 it is a polymorphic VI and you can just change it.  I wrote an example here for Chaz: http://forums.ni.com/t5/NI-TestStand/How-to-execute-two-steps-in-parallel/td-p/1449874
    It's the second example that's attached.
    Hope this helps,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~
    Attachments:
    AccessLocalVar.JPG ‏67 KB

  • How can I use java on the web?

    hi
    I would like to learn about making websites using java?? do i have to learn about javascript or another type of java??
    Im new in using java applet, threading and stuff like that :).
    And maybe I can make management systems in java language is this possible?
    thanks

    mshadows wrote:
    hi
    I would like to learn about making websites using java?? do i have to learn about javascript or another type of java??
    javascript is not a type of java. It is a separate language. What do you mean by "making websites". A website in its simplest form is just an HTML page. If you want to learn what's called a "server side web programming language", which will allow you to do things like retrieve data that a user entered into a form on an HTML page and store it in a database, then first you need to learn basic java, and then you need to learn basic HTML(and it would be beneficial to learn basic javascript although that's not mandatory), and then you need to learn "servlets+jsp"--which is the java version of a "server side web programming language". The easiest "server side web programming language" to learn and the one that is most popular is php.
    Some books you might consider:
    beginning Java: "Java2: A Beginner's Guide"
    beginning servlets+jsp: "Murach's Java servlets and JSP(2008 edition)" -- includes an introduction to HTML
    Im new in using java applet, threading and stuff like that :).OK. You don't need know applets or threading to learn servlets+jsp.
    And maybe I can make management systems in java language is this possible?
    Sure.
    Edited by: 7stud on Jun 6, 2008 10:17 PM

  • How can get & use java true type fonts in my applets

    Hi
    I could get the System fonts in my Applet by making use of Toolkit.getFontList()
    I have used getGraphicsEnvironment to get fonts but my browser doesn't support it.I get ClassNotFoundException.
    How can I get & make use True Type Fonts in my Java Applet.
    any body knows reply immediate pls
    Siva

    similar problem:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=164516
    sorry, thats all i know.
    tobias

  • How can I use java with DMI(Desktop Management Interface)? Help please..

    I want to use Java to develop DMI. Please help...Thanks.

    You are not getting replies because your question may need a course to answer. Just like, hey, can someone tell me how to write an email application? Or,
    Can someone show me how to build a house?
    Start writing your application, when you get stucked, post your questions.
    Or, at least be more specific. Like, elaborate DMI and things like that.
    Do a search on DMI, you may find what you need.

Maybe you are looking for

  • How can I create a new layer that is a gradient?

    Hi, i'm very new to photoshop scripting and am having some trouble. I'm looking for a way to take an image i have and set it to have a gradient opacity as it approaches the middle, my thought on how to do that was to just create a layer that is a gra

  • Disk Utility cant repair my external hard drive?!

    I'm using a 1 TB WD external hard drive on my Macbook Pro (OS is still Snow Leopard). It was working just fine until a few days ago the hard drive does not show on finder. I tried to repair it with disk utility but it gave the following message "Disk

  • Why is my iCloud no longer syncing files?

    I have noticed over the past several days that my word documents are no longer syncing between my devices, particularly my macbook and macbook air. I've checked for updates, and it presents to be occuring only across word, powerpoint, excel etc and b

  • Create .jspx page to add users using ADF security.

    Hello, I'm using JDeveloper 11.1.1.3. I've created a login page (form based) with different users and roles using ADF Security. I'm able to successfully login/logout through the users and get redirected to the home page. However, i'm asked to create

  • CT-3 form creation for procurement cycle

    dear experts !!! CT-3 certificate is required to be obtained from the Range Superintendent of Central Excise on the basis of which a 100% EOU can procure duty free indigenous goods. CT_3 is always quantity based and value based. After receipt of mate