Setting the value of a java variable in javascript function

How can i set the value of a java variable in a javascript function?
<%
String fName = "";
%>
now i want to define a javascript function which can set the value of fName to the value it has been passed.
<script language="javascript">
function setJValue(val)
</script>
Thanks

The only way you could simulate this, would be call the same page inside the Javascript function, and send it the parameter that was passed. Then you would have your Java code retrieve this parameter by request.getParameter("value");, and set the variable accordingly.

Similar Messages

  • Problem setting the value of a substitution variable in a calc script

    Hi, All.
    I'm trying to update the value of a substitution variable inside an IF statement and I'm having trouble.
    Here's the code:
    *"Jan"(*
    IF  (LoopCounter = 1) &varEntity = "100";
    ENDIF;)
    the error I get back from EAS is:
    Error: 1200336 Error parsing formula for [Jan] (line 54): [(] without [)]

    I know CL knows a lot about HBR, if he's around today... LOL
    As a matter of fact, I just used an HBR (not using Calc Manager till I have to)'s macro functionality to drive fx for different Scenarios in a Planning app. Here's how I call the macro:
              /*     Call the macro mcrFxCoreOutYears for the four fx rate types for ALL 12 months of the year.     */
              FIX(&BudYear)
                   %mcrFxCoreOutYears(Constant)
                   %mcrFxCoreOutYears(Comparable)
                   %mcrFxCoreOutYears(Estimate)
                   %mcrFxCoreOutYears(Actual)
              ENDFIXI pass the Scenarios Constant, Comparable, Estimate, and Actual to the macro mcrFxCoreOutYears. You can apply HBRs against Essbase.
    I believe (I can't remember what exactly -- is it that templates don't accept parameters? That seems hard to believe. Looking at a CM template, that does seem to be the case. Bummer if I'm right.) that Calc Manager BRs have less functionality wrt templates, but I haven't worked with CM for over a year.
    It works really well -- a single place to maintain code and no appreciable performance cost.
    You cannot launch a HBR from a MaxL script but HBRs can be launched from command lines -- this may constrain where you place your automation (it basically has to run off of whatever the EAS server is. You may end up shelling out of MaxL to execute the HBR or even execute scripts across servers -- that does get more complicated.).
    Anyway, if you have any more questions, ask away -- it really is a very powerful component. I will have to look at CM more closely (sooner or later I will lose the HBR vs CM argument and at least need to know if templates support parameters) to see if I'm right on what I wrote above.
    Regards,
    Cameron Lackpour
    P.S. You cannot define an ARRAY in an HBR macro because ARRAY arrayname[value] gets read as a parameter. I ended up declaring the array in the calling HBR.
    P.P.S. I really need to write up the fx approach in a blog post -- it is wicked fast and really easy to use. Too many other posts in the queue already.
    Edited by: CL on Aug 24, 2011 1:48 PM

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

  • HOW to set the value attribute of FORM INPUT data to a variable in a JSP

    eg. Registration.jsp
    The data is accessed from an hidden field called course
    for example, if I have "Java programming" in the field course, and I use
    an expression to access the value from the hidden field.
    **My problem is that the data gets truncated to "Java" , I need "Java Programming"to display. The code looks like this
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <INPUT TYPE="text" SIZE=12 NAME="course"
    VALUE=<%=getParameter("course") %>
    IS there ANY OTHER WAY to set the value of VALUE to a variable?

    Instead of value=<%=request.getParameter("course")%>
    Use double codes
    value="<%=request.getParameter("course")%>"

  • Scope issue: Trying to set the value of a variable in a calling (upper) script from a called (lower) script

    Hi,
    I have a basic scope question . I have two .ksh scripts. One calls the other.
    I have a variable I define in script_one.ksh called var1.
    I set it equal to 1. so export var1=1
    I then call script_two,ksh from script_one.ksh.  In script_two.ksh I set the value of var1 to 2 . so var1=2.
    I return to script_one.ksh and echo out var1 and it still is equal to 1.
    How can I change the value of var1 in script_two.ksh to 2 and have that change reflected in script_one.ksh when I echo var1 out after returning from script_two.ksh.
    I've remember seeing this I just can't remember how to do it.
    Thanks in advance.

    Unfortunately Unix or Linux does not have a concept of dynamic system kernel or global variables.
    Environment variables can be exported from a parent to a child processes, similar to copying, but a child process cannot change the shell environment of its parent process.
    However, there are a few ways you could use: You can source execute the scripts, using the Bash source command or by typing . space filename. When source executing a script, the content of the script are run in the current shell, similar to typing the commands at the command prompt.
    Use shell functions instead of forking shell scripts.
    Store the output of a script into a variable. For instance:
    #test1.sh
    var=goodbye
    echo $var
    #test2.sh
    var=hello
    echo $var
    var=`./test1.sh`
    echo $var
    $ ./test2.sh
    hello
    goodbye

  • How to set the value of process variables/payload using a managed bean?

    Hello,
    Someone can give me an example about how to set the values of a process payload in a managed bean?
    thank you!

    Try this:
    jsf page:
    <af:selectOneChoice label="Select Suburb"
    requiredMessageDetail="Select a suburb"
    valueChangeListener="#{selectOneChoiceBean.onValueChanged}"
    validator="#{selectOneChoiceBean.validate}"
    unselectedLabel="None" autoSubmit="true"
    binding="#{selectOneChoiceBean.selectOneChoice}"
    value="#{selectOneChoiceBean.value}">
    <f:selectItems value="#{selectOneChoiceBean.selectionList}"/>
    </af:selectOneChoice>
    backing bean:
    public class SelectChoiceBean {
    private List<SelectItem> selectionList;
    private String value = "B";
    private RichSelectOneChoice selectOneChoice;
    public SelectChoiceBean() {
    initSelectionList();
    public void setSelectionList(List<SelectItem> selectionList) {
    this.selectionList = selectionList;
    public List<SelectItem> getSelectionList() {
    return selectionList;
    public void onValueChanged(ValueChangeEvent valueChangeEvent) {
    System.out.println(valueChangeEvent.getNewValue());
    // Add event code here...
    public void validate(FacesContext facesContext, UIComponent uIComponent,
    Object object) {
    // Add event code here...
    private void initSelectionList() {
    selectionList = new ArrayList<SelectItem>();
    selectionList.add(new SelectItem("A", "A label"));
    selectionList.add(new SelectItem("B", "B label"));
    selectionList.add(new SelectItem("C", "C label"));
    public void setValue(String value) {
    this.value = value;
    public String getValue() {
    return value;
    public void setSelectOneChoice(RichSelectOneChoice selectOneChoice) {
    this.selectOneChoice = selectOneChoice;
    public RichSelectOneChoice getSelectOneChoice() {
    return selectOneChoice;
    }

  • Set the value of an adf number slider with java script

    Hi,
    i develop a adf 11 webapplication with JDeveloper 11.
    in one page i use the number slider component and i wish to set the value with a clientlistern in javascript.
    is this possible??
    thanks,
    hannes

    Hi,
    did you try
    slider = AdfPage.PAGE.findComponent("<sliderId>");
    slider.setProperty("value",<your value>);
    Frank

  • Setting the values inside xml file in xmlparsing

    Hi,
    Iu2019ve an xml file without containing any values inside the tags. I need to get the values from the text file and set the values inside the xml file. When I try to set the string variable inside the setValueNode()  using DOM parser, itu2019s not setting any values inside the xml file. 
    Please help me on this..
    Regards
    Vineela

    Hi,
    I am doing conversion from EDIFACT format to xml format.
    I am writing this code using core java. So I am using xmlparsing to convert my data. Iu2019ve one Hash table with me. I need to get the values from there and populate those values into xml file.
    Regards
    Vineela

  • Setting the value of a field based on a dropdown list

    I am using the latest production release of JHeadstart 10.1.3.0.91. I am trying to set the value of a field based on selecting the value of another field (drop down list). The drop down list field has the following attributes set autoSubmit="true" immediate="true" valueChangeListener="#{jhsPageLifecycle.updateModelValue}".
    The other field has the partialtrigger set to the first field. ie "depends on" selection from JHeadStart file. The value of the second field is set in the setter of the VO RowImpl java file.
    The value of that field is only populated on the screen if it is set to disabled="true". This seems a bit bizzare behaviour. Can you explain why it cannot set the value of the field when it is not disabled.

    Worked out that if i set the "Clear/Refresh value" attribute on the field that i want updated then it will work ok
    Alan

  • How to set the value of application item using pl/sql in application process

    Hi guys,
    I want a global variable (application item) whose value will be set at the start when a user logs in to the application. The value will be retrieved from database using a sql query. I do not know the exact syntax to set the value of application item in application process. Also i want to know in which type of application process should i use to set the value of application item when a user starts a session. The value of application item varies from user to user.
    Please help.
    I am using apex 4.2
    Regards,
    Waqas

    You can use the application item as bind-variable with its name. ie. your application item is named G_MY_APPLICATION_ITEM, then you can access/set it using :G_MY_APPLICATION_ITEM.
    For example
    BEGIN
        -- assign like a variable
        :G_MY_APPLICATION_ITEM := 'LARRY';
        -- use in a SQL statement
        SELECT WHATEVER_COLUMN
          INTO :G_MY_APPLICATION_ITEM
          FROM MY_TABLE
         WHERE USERNAME = :APP_USER
    END;
    Peter

  • DB2Exception - The value of a host variable in the EXECUTE or OPEN statemen

    I want to store a XML file into database.
    To undersdande my problem, please see the code below:
    java.sql.Connection conn = null ;
    PreparedStatement ps;
    // Here I'm calling a function to get Database Connection.
    String sXmlFile = "" ; // This variable stores a XML file as String
    String sSQL = "INSERT INTO Crs_x_xml (XML_TRAN_ID,XML_MESSAGE,SUSPENDED_FLAG ) VALUES(?,?,?)";
    try {
         ps = conn.prepareStatement(sSQL);
         ps.setLong(1,1);
         ps.setBytes(2, sXmlFile.getBytes());
         ps.setString(3,"A");
         ps.executeUpdate();
         conn.close();
    } catch (Exception e) {
         e.printStackTrace();
    The Problem:
    The table Crs_x_xml that I used has three columns, the first is a int, the second is a BLOB and third is Char(1) and its in DB2 running on AIX.
    Sometimes it execute very well. But sometimes gives following error :=
    COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/AIX64] SQL0302N The value of a host variable in the EXECUTE or OPEN statement is too large for its corresponding use. SQLSTATE=22001
    I dont know whats going wrong. Plz help....
    ~Abhijeet

    Hi,
    I am using a CMP query in websphere, in which i am trying to execute a select query.
    The query is as follows:
    SELECT OBJECT(o) FROM HrTmmbrAct o WHERE o.tmmbrActC IN ( 1,2,3 ) AND o.effD BETWEEN '2000-02-11' AND '2008-02-22'
    The tmmbrActC is defined as a string in the Websphere CMP fields. I am not sure now to pass the value to it. Do we need to pass it as objects. pls help.
    Thanks
    - Giri

  • How can I set the value to a session bean from backing bean

    Hi Experts,
    How can I set the value to a session bean from backing bean where I have created getter and setter
    methods for that variable.
    Basically I am using ADFUtils class where I am able to get the value from session bean
    using following expression
    String claimType =
    (String)ADFUtil.invokeEL("#{ClaimValueObj.getClaimType}");
    Thanks
    Gayaz

    Gayaz,
    Wrong Post !!
    Post in JDeveloper and ADF
    Thanks
    --Anil                                                                                                                                                                                                                               

  • Loading a file and setting the values in a Jtextfield

    Hi all,
    I've created a save and open menu option for my application. The save option works as it writes to file using jFileChooser. However when using the open file option the program opens the correct file and stores the strings read into a string variable, however when I go to set the value stored in the variable to a specific textfield using settext method, it doesn't do anything. Please can someone give me some suggestions on what I am doing wrong. The following is the code snippet that accesses the file and reads from it:
    try
    int result = jFileChooser1.showOpenDialog(this);
    if ( result == JFileChooser.APPROVE_OPTION )
    String str1 = jFileChooser1.getCurrentDirectory() +
    System.getProperty("file.separator") + jFileChooser1.getSelectedFile().getName() ;
    FileReader f = new FileReader( str1 );
    BufferedReader b = new BufferedReader(f);
    while((text1 = b.readLine()) != null)
    //text2 = b.readLine();
    jTextArea1.append("\ntext1: "+text1+"\nsize: "+size);
    if(text1 == "// System Configuration")
    text1 = b.readLine();
    size = text1.length();
    //text2 = text1;
    jSampleRate.setText(text1);
    text1 = b.readLine();
    size = text1.length();
    //text2 = text1;
    jFrequency.setText(text1);
    text1 = b.readLine();
    size = text1.length();
    //text2 = text1;
    jVoltage.setText(text1);
    text1 = b.readLine();
    size = text1.length();
    text2 = text1;
    jFSVoltage1.setText(text1);
    /*if((text = b.readLine()) == "// Phase Selection")
    // READ INFORMATION LOOKING FOE THE SPECIFIC TAGS
    b.close();
    jFileChooser1.cancelSelection();
    Any suggestions wpould be very much appreciated. Thanks in advance.

    this is the result from the read in information:
    text1 is the string variable that is used to store the information read in from the file, while size is the variable used to obtian the size of the string. Does the readline() method have any properties which would affect what is being read in?
    text1: |=========================================================================================
    size: 0
    text1: | File Name: C:\CsoundTest\walid3
    size: 0
    text1: | Last Modified: 30-01-2003 11:25:11
    size: 0
    text1: | Warning: Do not modify the information stored in this file. If modified the inforamtion
    size: 0
    text1: | may not be retrieved correctly when loading the file into the main program.
    size: 0
    text1: |==========================================================================================
    size: 0
    text1:
    size: 0
    text1: // System Configuration
    size: 0
    text1: 500
    size: 0
    text1: 50
    size: 0
    text1: 230
    size: 0
    text1: 300
    size: 0
    text1:
    size: 0
    text1: // Phase Selection
    size: 0
    text1: 1VIncN
    size: 0
    text1:
    size: 0
    text1: // Duration
    size: 0
    text1: 0
    size: 0
    text1: 00
    size: 0
    text1: 00
    size: 0
    text1:
    size: 0
    text1: // Disturbances
    size: 0
    text1:
    size: 0
    Regards
    walidr

  • Set the value of items when check box is checked

    Hi,
    My requirement is when we click a check box it should set the value of an item as 111111 and clear the values of two items in an apex page.
    I used java script onClick event to set those items using document.getElementByID('Item_Name')='';
    One of the item which needs to be cleared is a conditonal type.
    When the condional item present, java script works fine. But if it is not present,
    code works but it shows "error on page" for few seconds.
    Is it possible to clear the item, only when the item is present in the page.
    Thanks,
    Ravi

    Hi,
    Yes e.g. like
    if($x("ITEM_NAME")){
    $s("ITEM_NAME", "");
    }Regards,
    Jari

  • Setting the value of rich inputtext in jdeveloper 11g 11.1.2.3.0

    Hi,
    I am trying to set the value of input text in my .jspx page to the value of a command link. On the click of the link the value of the link needs to be displayed in the input text without having to type it.
    I have created an action method for the command link where I get the value from the command link and set it in the input text. I see in my log it is getting the current row from the command link but nothing is being set in the input text. Following is my code for the command link action method:
    This is where I am getting the value from the command link:
                    DCControlBinding cb;
                    cb = (DCControlBinding) bindings.get("ALL_DETAILS_ITEM");
                     System.out.println("cb  " + cb);
                    Row currentRow;
                    currentRow = cb.getCurrentRow();
                    System.out.println("currentRow " + currentRow);
                    String EMAIL_ADDRESS = null;
                    if ((currentRow.getAttribute("EMAIL_ADDRESS"))!= null)       
                       EMAIL_ADDRESS = (currentRow.getAttribute("EMAIL_ADDRESS")).toString();
                       System.out.println(" EMAIL_ADDRESS " +  EMAIL_ADDRESS);                                       
                           }This is where I am trying to set the input text value(P_EMAIL_ADDRESS) to the command link value(EMAIL_ADDRESS)
                        Map params = operationBinding.getParamsMap();
                        String P_EMAIL_ADDRESS = null;
                    if ((currentRow.getAttribute("P_EMAIL_ADDRESS"))== null)       
                        currentRow.setAttribute("P_EMAIL_ADDRESS", EMAIL_ADDRESS );
                         System.out.println("P_EMAIL_ADDRESS " + P_EMAIL_ADDRESS);                                       
                           params.put("P_EMAIL_ADDRESS", P_EMAIL_ADDRESS);
                           params.put("DISPLAY_TYPE", DISPLAY_TYPE);
                           Object result = operationBinding.execute();
                }I also have set a partial trigger of the input text to the command link Id in the UI.
    Any help would be appreciated.
    Thanks in advance,
    Sal

    This is overly complicated. you post the code of you command link?
    should work without any java code by setting a property listener which the from value set to the value of the link and the to property to the of the input text.
    Timo

Maybe you are looking for

  • Best Practice "One SSID for everything"

    Hello Guys, we switched from ACS to ISE and now we want to have just two SSIDs for alle Business Needs: I´m not sure if this is the right or best way to do it. One SSID is for Guest Network and also for BYOD Registration. The second SSID is for BYOD

  • Strange Adobe Installer Issue

    I am on a updated version Of Windows 7 x64, with Firefox browser fully updated. Firefox V.34.0.5 I download Adobe Update from Adobe only, once the DL is complete I allow, and run as admin, i have tried it without Admin as well. It opens and at that p

  • Howto: VPN server authing off Active Directory

    It is indeed possible to use the VPN server on OS X Server to authenticate VPN users against Active Directory using Radius. I've set it up twice now and it works well. Binding your server to AD doesn't work for the VPN service, you only have this opt

  • Mep 0

    my torch 9800 shows mep 0 left plz help me in this matter

  • Automate script to display result

    Hi everyone, I'm beginner at PL/SQL. I want to automate this request so it will be lunched every day at 12:00(AM) and I can display the result select col1 from table_A where col_date >='sysdate -1 12:00:00'; thank you, Regards Edited by: 961285 on 25