How to pass a java script variable to a JSP page

How to assign a javascript variable value to a jsp variabe
<script>
var scroll="100"
</script>
<%
String age=[ here i need to set the value of "scroll" ]
%>
is it possible ,
thanks

assign this scroll to a hidden field in a form
and pass via form to server this may be one way or
set attribute scroll and then access to server side
may this help you
--yogeshb                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • How to access a JAVA Script variable in JSP Code

    How to access a JAVA Script variable in JSP Code. I have been unable todo this.
    Plz Suggest a way.
    Thanks
    Soumya

    try to do this code
    String s=request.getParameter("javascriptvariablename");

  • How to get the value retruned by java script function into my jsp page

    Hai all,
    I had a particular java script function which returns a date.
    function getDate() {
         var sDate;
    // This code executes when the user clicks on a day in the calendar.
    if ("TD" == event.srcElement.tagName)
    // Test whether day is valid.
    if ("" != event.srcElement.innerText)
    //alert(event.srcElement.innerText);
    sDate = document.all.year.value + "-" + document.all.month.value + "-" + event.srcElement.innerText;
    document.all.ret.value = sDate;
    var mahi=window.open("configurexml.jsp?xyz=document.all.ret.value")
    return sDate;}
    Now i want to display this particular date in my jsp page. can anyone tell me the correct approach or a sample code to diaplay this date in my jsp page.
    <%@ page language="java"
    import="javax.xml.parsers.*,java.io.*,org.w3c.dom.*"%><%@ page import="java.util.*" %>
    !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html> <head> <title>Configuring Xml File</title>
    <SCRIPT LANGUAGE="JavaScript" SRC="xyz.js"> </SCRIPT>
    body bgcolor="#d0d0d0" onClick= "return getDate()" >
    <form name="f1">
    <b>20 october 2006 </b>
    Here where i am printing the date i had to get the value from the js function. how to do that. plz help me....

    Are you talking about server-side java code (servlets/jsp) or client side (applet)? Given we are in the JSP forum I'll assume we're talking server side.
    If so, you are making a common but fundamental mistake. JavaScript executes on the client, not on the server. If you want client data on the server it has to get there somehow. The simplest way to do this in JSP land is via HTTP. So... have your JavaScript code call a JSP (or servlet) and pass the value you want as a URL parameter. Of course this will also change the browser location, so if you don't want this to happen use a frame or iframe to capture your HTTP request.
    For example:
    Javascript....
    function someFunction() {
    return 1;
    var value = someFunction();
    location.href="somejsp.jsp?value=" + value;

  • How to pass servlet parameter using encodeURL function in JSP page

    Hi!!!
    I have a very urgently problem.
    in my JSP I have this:
    <IMG border="0" src='<%=response.encodeURL("/MyImageServlet")%>'>
    In this way, my servlet works fine (and I have in my page my blob-image).
    But I have to pass to my servlet a list of dynamic parameter. I have tried all the possibilities like:
    <IMG border="0" src='<%= (response.encodeURL("/MyImageServlet") + "?Param_name=" + sessionBean.getParamValue() + "&anotherParam" + sessionBean.getAnotherParamValue())%>'
    but nothing....
    In my servlet I use the init function to retrieve the initial parameters(defined in my web.xml file) in this way:
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    myParam = getInitParameter( "name_of_param");
    but I retrieve only the default value (-1).
    How to pass to my servlet the parameters? Please help me!
    Excuse me for my english,
    thank you for your help!

    Hi!
    Thanks for your reply!
    I have tried this solution but it doesn't work!
    When I do getInitParameter in the init function, the servlet take the default values...
    Maybe I have wrote something wrong?
    Excuse me for my english,
    Thanks

  • Returning/passing Java script variable/value to PL/SQL environment

    Hi,
    Can someone give me a sample code about how to return a Java script variable to PLSQL environment?
    for example, I have a javascript function that returns timestamp in milisecond, I then want to write PLSQL code to call this java script function and save its value in a number-typed plsql variable for further calculation, I dont know how the two scripting language communicate.
    Thank you very much
    Binh
    null

    This is quite simple.
    I assume that you are able to define html form side through pl/sql. Suppose your new pl/sql value is v_time then in the procedure that you write include one more statement
    htp.p('<Input type=hidden name="v_time" value="">');
    and also in the form invocation,
    htp.p('<form name=app method=post action="time_handler" onSubmit="return false;">');
    and to the end you must be having a submit
    to it attach a onClick function that calls
    simply our validate function..
    eg htp.p('<Input type=submit value="process"
    onClick="validate();">');
    Include in the head portion
    the following script using htp.p procedure
    function validate()
    app.v_time.value=<calculated value>;
    return app.submit();
    Hope this helps.
    Nat
    null

  • Passing importing parameter in  ABAP to  java script variable

    Hi Experts,
    I am calling a ABAP function module in javascript.Now how can I take importing parameter in  ABAP to java script variable. Because I need to give alert using the improting Paramter value...
    Thanks in advance..
    RR

    to pass ABAP variable value to javascript variable the syntax is
    var myjsvariable = "<%=abapvariable%>";
    Edited by: Durairaj Athavan Raja on Jul 29, 2009 2:39 PM

  • How to Use the JAVA SCRIPT code in .htm page of the component

    Hi .
    In my requirement i have to use Java Script Function in .htm code ..how to use the java script code and functions in .htm???
    thank you
    B.Mani

    Check this document  [Arun's Blog|http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebClientUI-TalkingwithJava+Script]
    Regards
    Kavindra

  • How to call a java script in while eventprocessing?

    hi friends,
    How to call a java script from an event.
    when i click a button, i want to display a message in IE.
    For ex: BTN_CAN,
    When i click on this in IE i want show a message like "clicked on cancelled".
    how can i do this.....
    in javascript WINDOW.ALERT i am trying....
    Regards,
    Shankar.

    you can do some thing like this...
    < % @  pa g e la ng uag  e="a b ap" %>
    < % @ e xte n sion name="htmlb" prefix="h tm l b"  %  >
    <  h t  m l b:co  nt e nt d es ign="design2 00  3"  >
      <  ht m lb:page title=" "    >
        <  h tm lb :for m  >
           < h t  mlb:textVi ew text   = "Hello World!"
                          des  ign = "EMPHASIZED" />
          < ht  m lb  :bu  tton text          = "Press Me"
                         on  Clie  ntC lick = "al ert(' H ell  w or l d')"  / >
        <  / h t mlb  :for m >
      < / ht mlb :pa g e >
    <   / htm lb:co nt e nt >
    Edited by: Vijay Babu Dudla on Oct 6, 2008 7:20 AM

  • How to remove a java script pop up

    Hi,
    I imported a robohelp document from another company and i am
    catering it to my company's needs. The problem is they have popups
    which refer to .bmp and it is in java script. If i highlight the
    word which has the pop up and remove the popup and then highlight
    the normal word again and refer it to my topic in the project
    manger; it still refers to their image and not mine. It is strange
    but true. I don't know how to remove the java script cos each time
    i hover over the highlighted text there are 2 red squares on the
    left and right hand side of the word highlighted which i want to
    change from their image to mine.
    Any help would be much appreciated .
    Thanks,
    Ramya

    please take a look at this
    //--></script></robohelp>
    on the <b style="font-weight: normal;">Environmental
    Consequence</b> window
    captures and displays information that you reported to a
    governmental
    agency, police, rescue center, or internal company sources.
    </p>
    <div class=droptext id=POPUP286607275 x-ss-type=dropdown
    style="display: none;">
    <p class=Graphic style="margin-left: 0in;"><img
    src="agency_notification_tab.bmp"
    x-maintain-ratio=TRUE class=img_whs2 style="width: 1108px;
    height: 120px; border-style: none; border-style: none;"
    width=1108 height=120 border=0></p>
    </div>
    <p class=Body>The following is a description of some of
    the fields that
    display on the <b style="font-weight:
    normal;">Agency Notification</b> tab:</p>
    <ul class=whs3 style="list-style: disc;" type=disc>
    <li class=p-BulletedList1><p
    class=BulletedList1><b style="font-weight: bold;">Reported
    By</b> - Person who reported the incident to an agency
    or organization.</p></li>
    <li class=p-BulletedList1><p
    class=BulletedList1><b style="font-weight: bold;">Agencies
    Notified</b> - Agencies or organizations notified
    about the incident.</p></li>
    <li class=p-BulletedList1><p
    class=BulletedList1><b style="font-weight:
    bold;">Contact</b>
    - Contact person at the notified agency or
    organization.</p></li>
    <li class=p-BulletedList1><p
    class=BulletedList1><b style="font-weight: bold;">Notify
    Date</b> - Date the agency was
    notified.</p></li>
    <li class=p-BulletedList1><p
    class=BulletedList1><span style="font-weight:
    bold;">Comment/Report
    Number</span> - This field can be used to record any
    comments, notes,
    agency report/case numbers associated with the agency
    notification. </p></li>
    </ul>
    <p class=TableText><a href="javascript:void(0);"
    onClick="var e; if (parseInt(navigator.appVersion)>=4){e=event;}
    if (parseInt(navigator.appVersion) >=2 &amp;&amp;
    typeof(PopupMenu_Invoke) == 'function')
    PopupMenu_Invoke(e,'','Action
    Buttons','../../03_Getting_Started_files/Action_Buttons.htm','Adding
    a Row','../../03_Getting_Started_files/Adding_Row.htm','Adding Text
    Entries','../../03_Getting_Started_files/Adding_Text_Entries.htm','Deleting
    a
    Row','../../03_Getting_Started_files/Deleting_Rows.htm','Environmental
    Consequence
    Record','EC_Environmental_Consequence_Record.htm','Searching by
    Personnel
    ID','../../03_Getting_Started_files/Searching_by_Personnel_ID.htm','Selecting
    the
    Time','../../03_Getting_Started_files/Selecting_Time.htm');return
    false"
    title="Related Topics" id=a2 style="position:
    relative;"><img src="../../ss_btn_related_topics1.gif"
    alt="Related Topics" style="width: 81px; height: 17px;
    border-style: none; border-style: none;"
    width=81 height=17
    border=0></a><robohelp><script
    type="text/javascript"
    language=JavaScript1.2><!--
    InitEffects('a2');
    //--></script></robohelp>
    </p>
    <script language=javascript1.2
    type="text/javascript"><!--
    kadovTextPopupInit('a1','POPUP286607275');
    //--></script>
    if you could paste this code on your word doc and try to
    search for .bmp it exactly shows where it is used i tried removing
    that line but it acted strange as even when i added a pop up to a
    word it does not show anything in the view mode.

  • How to call a java script?

    Hi,
    I m new to Indesign and also to MAC OS...
    I ve tried the sdk samples of InDesign CS3 on MAC OS. It works well.
    I m making changes to one of the samples (BasicPanel). I ve added few check boxes and buttons in it. I donno where to give the code for button(in the panel) event/action?
    I also need to know "how to call a java script from InDesign CS3 SDK ?"...
    I have the Scripts ready... Can someone provide the code used to call JS...
    Someone pls help me.....
    Thank You...

            Here s the code to call a Javascript:
            IDFile scriptFile;
            FileUtils::GetAppInstallationFolder(&scriptFile);                    //application folder path
            FileUtils::AppendPath(&scriptFile, PMString("Scripts", -1, PMString::kNoTranslate));               
            FileUtils::AppendPath(&scriptFile, PMString("Scripts Panel", -1, PMString::kNoTranslate));
            //inside the scripts panel, append path of the folder in which ur script is present.
            //Suppose, ScriptsPanel->NewFolder->Link.jsx
            FileUtils::AppendPath(&scriptFile, PMString("NewFolder", -1, PMString::kNoTranslate)); 
            FileUtils::AppendPath(&scriptFile, PMString("Link.jsx", -1, PMString::kNoTranslate));
            InterfacePtr<IScriptRunner>scriptRunner(Utils<IScriptUtils>()->QueryScriptRunner(scriptFi le));
            bool filestatus=scriptRunner->CanHandleFile(scriptFile);
            if(filestatus==1)
                scriptRunner->RunFile(scriptFile,kTrue,kFalse);
    Regards,
    tnhems

  • XSLT - How to pass a Java object to the xslt file ?

    Hi ,
    I need help in , How to pass a java object to xslt file.
    I am using javax.xml.transform.Tranformer class to for the xsl tranformation. I need to pass a java object eg
    Class Employee {
    private String name;
    private int empId;
    public String getName() {
    return this.name;
    public String getEmpId() {
    return this.empId;
    public String setName(String name) {
    this.name = name;
    public String setEmpId(int empId){
    this.empId = empId;
    How can i access this complete object in the xsl file ? is there any way i can pass custom objects to xsl using Transformer class ?

    This is elementary. Did you ask google ? http://www.google.com/search?q=calling+java+from+xsl
    ram.

  • How & where to use Java script to create new button in object detail page

    Hi All,
    I want to create "New/Add button" in object detail page. If i am not wrong i need to use java script for that but could you please let me know how & where to use Java script to create new button in object detail page in CRMOD.
    Thanks in advance.
    Regards,
    Manish

    Any related object on the detail page should have an "Add" or "New" or both buttons by default - This is vanilla functionality and will do the required action.
    If you want to modify this behaviour and do something tricky you will potentially have to go for javascript. You should add the javascript on a custom web tab on that Object.
    Admin --> Application Customization --> Contact -->Contact Web Applet
    Now, add your javascript in the code area, after you select the type = HTML for this web applet, expose this web applet on the Contact detail layout and your javascript will be invoked whenever this page is loaded.
    Check this online document to see how javascript can be embedded in CRM on Demand http://helponmyproject.com/TTOCOD/
    Cheers!
    Royston

  • HT1338 how can i update java script

    how can we update java script on our mac book?

    Apple supplies their own version of Java.
    Try Software Update.

  • How I can play java script game

    Hello,how I can use java script games, such a chess

    Go here: http://htmlchess.sourceforge.net/demo/example.html or http://valil.com/chess/chess_include.html on your iPad.
    Those JavaScript chess games work fine on the iPad. There are others if you Google for "Javascript chess game", but as PogoPossum said, you'll find better ones in the AppStore.

  • How can I disable java scripts permanently in iPad

    How can I disable java scripts permanently in iPad ? When I access web site with smart app banner, than I get javascripts enabled automatically .

    I do it exactly there , after I go to web site where is smart app banner and it enables javascripts its self. After wisiting that web site ,I go to settings>safari>javascript  and I find it is "on" again.

Maybe you are looking for

  • Why did my mouse stop scrolling after upgrading to mavericks?

    I have completely lost all ability to scroll with my Apple Magic Mouse after upgrading to Mavericks.   Why did this happen?   How can it be fixed?    It worked fine with Snow Leopard and Mountain Lion. 

  • Calling stored procedure

    Hello Techies I want to call a stored procedure which does not return anything but it executes the query inside itself. How should I take the output from it �I want 3 values from that procedure. The stored procedure is::::::: CREATE Procedure NewPFAt

  • Vendor Evaluation - calculating score for subcriteria Confirmation date

    Hi, I have configured vedor evaluation with subcriteria Confirmation date with B But while maintaing vendor evaluation ,system is not calculating score. As per my understanding system compares the date of inbound delivery and actual GR date. Can some

  • I need an EIN : Employer Identification Number to publish.

    Hi, I'm currently living in Japan and I'm a french citizen. I would like to sell ibooks under the name of my company established in Japan. I have an App developer Account and from what I understand, I cannot use it to publish books on the iBookStore.

  • ClassNotFoundException,open HTTP connection failed

    Hai All, when I try to run my applet in webpage the applet is notinited & i found the following stacktrace in java Console: Requesting URL: http://localhost/PCC/Applet/ImgDemo.class load: class ImgDemo.class not found. java.lang.ClassNotFoundExceptio