I want to assign the value of a Javascript variable to JSP Variable

I want to assign the value of a Javascript variable to JSP Variable .. for example :
<%
Bla Bla Bla
%>
<script>
var JavaScriptVariable="hello"
</script>
<%
String JSPVariable=// The Value of JavaScriptVariable ;
%>
How can i do that ??
Thanks

>I want to assign the value of a Javascript variable to JSP Variable
cannot be done.Friend try to understand concepts properly Javascript is always excuted by the browser @clientside where as JSPCode is executed Websever(ServletContainer) @serverside.Through you are combining JSP Code blocks(Tags,Expressions,scriptlets...) & javascript under a single page webserver can only identify what is their under JSP Code blocks.
Hope this could be an appropriate answer for your question.
However,you can as well submit a request by encoding your URL with request parameters and the submit to the page and then collect it using request.getParameter(name).
But under a single context state it is not possible
REGARDS,
RaHuL

Similar Messages

  • Assigning return value of a javascript function to a variable

    hi.
    I have a javascript function which returns string.
    I wanna assing return value of that function to variable.
    for example:
    <script>
    funtion writeMe()
    var ex;
    ex="try"
    return ex;
    </script>
    Then in body of JSP page. I wanna do something like:
    <% String st;%>
    Now I wanna assign the value that returned from writeMe function ("try") to st string.like:
    <%st= writeMe();%>. but of course it doesn't work. how can I do that?

    thnx. but actually what I want to do is sending some values produced by javascript to a barchart object. is it impossible too?
    I mean my script function returns something like "100, 200, 300". I wanna pass that values to barchart. when I want to add aplet tag to jsp code instead of writing:
    <param name="s1_value" value="100,200,300">
    I want to write somethin like:
    <param name="s1_value" value="myscriptfunction()">
    is it possible in JSP? I saw an example like this in asp. it was like:
    <param name="sampleLabels" value="<%call func1()>">. but in JSP it seems like call tag doesn't work. Is it possible in JSP?

  • How can assign the value returned from javascript to Hidden item

    Hi All,
    I have created a report with button in one column adding following code to SQL select statement like
    SELECT USER_RQST_ID, USER_RQST_DESC, RQST_DATE, STATUS, USER_ID, CNTRY_ID, KPI_LIST, YEAR_LIST, QTR_LIST, MONTH_LIST,
    PROD_LIST, FULL_PERIOD_FLG, GEN_DATE, '<input type=button value="view_list" onclick="javascript:doSubmit('||USER_RQST_ID||');">' button FROM KPI_USER_RQST;
    Then i have implemet doSubmit() function in Javascript like
    function doSubmit(req_id)
    html_GetElement('HIDDEN_ITEM')= req_id.value;
    Here HIDDEN_ITEM is the name of the item, I want to use that HIDDEN_ITEM value in PL/SQL block like...
    BEGIN
    INSERT INTO SAMPLE(KEY) VALUES(:HIDDEN_ITEM);
    END;
    But it is not working, Please help me anybody know the solution How to assign an item in javascript block function.
    Thanks,
    Neel

    Hello,
    doSubmit() is one of the built in javascript functions in apex and it's a bad idea to override it unless you know exactly what you are doing, and even then is a generally bad idea.
    change your function to this
    function mySubmit(pValue){
    $x('HIDDEN_ITEM').value = pValue;
    doSubmit();
    then your onclick will look like this notice the lack of the javascript: and the three ''' quotes to get the proper quotations for your value.
    onclick="mySubmit('''||USER_RQST_ID||''')"
    And there you go
    Carl

  • How to assign the Value to the Particular field-Text field

    Hi all,
    My requirement is to call the Web service with input from the ADF page.
    Steps I have done:
    1. I have created a Web service data control based on the WSDL file.
    2. Just drag and drop the Process, It is automatically created the form with the Input fields and then the Process button
    3. When I entered the values and then process button it will pass the values corretly.the web service is invoked correctly with the values entered.
    4. But when I try to assign the value from the some other field that is not working.
    I am assigning the Value to the field by go to the properties of the Particular field value =”CREATE”
    When I do like this that value is showing in the screen. But it will not pass the value to the web service.
    I think the value is only displaying in the screen. Not stored at bindings level. Kindly guide me in this.
    Thanks in Advance
    C.Karukkuvel

    If you want to have the value that is returned displayed in a field that has binding to another item and not the WS result item then the way to do this would be to override the method that is invoked with the button that calls the web service - you then take the result and assign it to the item you want.
    See the way it is done here:
    http://blogs.oracle.com/shay/2009/07/java_class_data_control_and_ad.html
    While this sample uses a simple method it would be basically the same for a Web service.

  • I want to get the values from the second hiphen only

    Hey Guys,
    I have one column and the data like this
    col1 = 'AI463-901-001'
    Now,
    I want to get the values from the second hiphen only(any no. of values).
    Please can any one help me on this .
    Thanks in advance!
    Regards,
    -LK

    you have a mistake
    you result is -001
    this is right
      select substr('AI463-901-001',instr('AI463-901-001','-',1,2)+1) from dual;
      -- @user11928732 -  if you are using Oracle Database 11g, ttry this please
    with data as
      (select  'AI463-901-001'from dual)
      select substr(str,instr(str,'-',1,2)+1) from data;
      select substr(<YOUR COLUMN>,instr(<YOUR COLUMN>,'-',1,2)+1) from <YOUR TABLE>;result is : 001
    Edited by: Mahir M. Quluzade on May 3, 2011 5:37 PM

  • Error in ECA when assigning the value to structures

    Hi,
    There are errors in ECA when we execute our function modules.               
    Say a script has 3 interfaces (just an example)
    1) In the first command interface, there is a reference to a structure which has 3 nested structures within, in which the inner most 3rd structure is filled.   
    2) In 2nd interface, the inner most structure in null.                      
    3) In third interface, it is trying to initialize only those elements       
    that were already initialized and we get a empty node error for the 3rd 
    nested structure, when it tries to assign the value .
    Here is the error message that we encounter
    "The Node IT_TABLE_INPUT_DATA[1]-DATA[2]-COMPARE_OPERATOR of Object VS_EDIT_LIST Does Not Exist"*     
    Please help us in resolving this issue.
    Thanks,
    Asha
    Edited by: Asha Nagaraj on Jan 19, 2009 11:57 AM

    Hi,
    We tried to parameterize in the node level rather than Struture level, still the same problem persists, becoz
    1. In the first command interface the value has been assigned to internal node
    2. In the second command interface there is no value to assign, so null value is assigned to that node
    3. in the third command interface, when it tries to assign the value to the node which was assigned "null" in the previous interface, we are encountering that issue. it is not able to find that node
    Let me know if u need further info.
    Thanks,
    Asha

  • Customer want to decrease the Value of AUC

    Hi, Expert
    They want to decrease the value of AUC and post it to other GL account.
    Dr  other balance sheet account
    Cr  AUC
    What Transaction type i need be be used?
    The value decrease is just apart of AUC 's value.
    Thank you very much for helping.

    HI,
    Decrease the value becuase they sold the asset then  please use trnasaction ,
    ABAVN - Asset Retirement by Scrapping
    F-92 - With Customer
    ABSO nd choose the proper Transaction typ e.

  • I want to post the values of the form in the same Jsp Page

    I want to post the values of the form in the same Jsp page.

    Was that a question? Or are you just informing the world of your grand intentions?
    But yeah, all you need to do is direct your action to the same page you're in. So, if this is your foo.jsp, it'd be something like...
    <%
    if(request.getParameter("bar") != null) out.println("Hello");
    %>
    <form method="post" action="foo.jsp">
       <input type="text" name="bar" value="baz">
       <input type="submit">
    </form>When you submitted your form, it would post the value to the same JSP page as you're already in, and print out Hello to the screen. "Hello" would not print out on the first visit, as the request would obviously not contain the parameter "bar" yet.

  • I want to set the value to the radiobutton dynamically.How it possible

    Hi all,
    I want to set the value to the radio button dynamically.but its giving undefined.
    below is the code...
    <table>
    while(rSet.next())
    String sim=rSet.getString(1);
    System.out.println("the sim value is:"+sim);
    %>
    <tr class="forsmalllabel">
    <td><input type="radio" name="acsRadio"
    value="<%=rSet.getString(1).toString().trim() %>" onClick="validate(this.form)" > </td>
    </tr>
    <% } %>
    </table>
    sim variable giving the correct value ...but here ..
    whenever I am clicking on the button..it giving undefied message.
    my script is below..
    <script language="javascript">
    function validate(value)
    alert("the value is:"+document.ASCCodeform.acsRadio.value);
    return true;
    </script>
    any one help me on this..
    urgent.
    Thank you,
    D.Nagireddy.

    swish is correct, it can be an array of radio button or a single button. If you have created more than one radio button your will have to use
    document.ASCCodeform.acsRadio[x].valuebut if it is only one you will make it:
    document.ASCCodeform.acsRadio.value

  • I want to clear the values for the controls

    Hi all,
            After Adding Process, i want to clear the values for the controls in the form.
    Any one help me.

    If you use 2005, you can use the Formdata Event and catch the FORM_DATA_ADD event... In there you can clear the data

  • Assign the values to Var

    How to assign the values to variable in SQL
    Thanks

    SQL> variable var number
    SQL> exec :var := 10
    PL/SQL procedure successfully completed.
    SQL> select :var as val from dual;
           VAL
            10
    1 row selected.
    edit
    And/or:
    SQL> begin
      2  select 20 into :var from dual;
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> select :var as val from dual;
           VAL
            20
    1 row selected.Edited by: hoek on Jan 5, 2010 3:26 PM
    edit II
    Actually Oracle has everything documented @ http://tahiti.oracle.com including lots of examples.
    For instance: http://www.oracle.com/pls/db112/ranked?word=variables&partno=e10823
    Edited by: hoek on Jan 5, 2010 3:28 PM

  • I want to assign the Url of a Sharepoint list page to a Constant, and I am using it into User Control navigate Url.

    I want to assign the Url of a Sharepoint list page to a Constant, and I am using it into User Control navigate Url.
    But it is Not working there , Could you Please Suggest me the Better way..
    Regards
    Nitesh

    Your question isn't clear. Can you explain what you're trying to do and what you've attempted?

  • Want to round the value can any body suggest

    hai all
    i want to round the value and store it in on variable
    eg:12334.789 as to 123345 it should be stored in some variable
    suggest me please
    thanks in advance
    sindu

    Hi,
    You can Use either
    FLOOR : Largest integer value that is not greater than 12334.789
    or
    CEIL: Smallest integer value that is not less than 12334.789
    or
    TRUNC :Interger part of 12334.789
    Eg:
    DATA: I TYPE I,
              X   TYPE P  VALUE '12334.789 '.
    I = FLOOR( X ).    output- 12334
    I = CEIL( X ).          output- 12335
    I = TRUNC( X ).      output: 12334
    regards
    Rakesh

  • Urgent : I want to modiy the values that are transfered from R/3 to CRM

    I have created a custom field in both CRM and R3. When the tha value of the firld is changed in VA02/Va01 i want the change the value in between. i want to change the value before it is changed in CRM how can i do it...
    Thanks in advance.

    Hi Bharath
    You can use the BADI 'CRM_DATAEXCHG_BADI'. In this BADI, use the method 'CRM_DATAEXCH_R3D_MBDOC_FILL'. this is for data transfer from R/3 to CRM.
    Please reward points if helpful!!
    Warm regards
    Debolina

  • How to get the value from a JavaScript and send the same to Java file?

    Hi.
    How to get the value from a JavaScript (this JS is called when an action invoked) and send the value from the JS to a Java file?
    Thanks and regards,
    Leslie V

    Yes, I am trying with web application.
    In the below code, a variable 'message' carries the needed info. I would like to send this 'message' variable with the 'request'.
    How to send this 'message' with and to the 'request'?
    Thanks for the help :-)
    The actual JS code is:
    function productdeselection()
    var i=0;
    var j=0;
    var deselectedproduct = new Array(5);
    var message = "Are you sure to delete Product ";
    mvi=document.forms[0].MVI;
    mei=document.forms[0].MEI;
    lpi=document.forms[0].LPI;
    if(null != mvi)
    ++i;
    if(null != mei )
    ++i;
    if(null != lpi)
    ++i;
    if(null != mvi && mvi.checked)
    deselectedproduct[++j]="MVI?";
    if(null != mei && mei.checked)
    deselectedproduct[++j]="GAP?";
    if(null != lpi && lpi.checked)
    deselectedproduct[++j]="LPI?";
    if( 0!=j)
    if(i!=j)
    for (x=0; x<deselectedproduct.length; x++)
    if(null != deselectedproduct[x])
    message =message+ "-" +deselectedproduct[x];
    alert(message);
    else
    //alert(" You cannot remove all products!");
    return false;
    return true;
    }

Maybe you are looking for