Share variable value between java script and jsp

Hi, Firends:
In my old web page I used a static array to hold a set of values, and now I want to use dynamic value from datbase.
I created a bean to process database data and return resultset value to an array string.
I convert my html page into jsp page, use "usebean" tag to call specific method, after done, how can I set the
resultvaule to my script variable?
It's urgent!! great thanks!

Hello,
Finally, the codes work! thanks for all the suggestion!
The most important is "J" need <%= tag too. and do not forget the double quotation mark ("") while assigning the value.
the code like following:
<jsp:useBean id="ArrayBean" class="myProj.BeanServices"
scope="page" >
</jsp:useBean>
<%! public String[] dataArray; %>
<%
dataArray = ArrayBean.getRecordsetReturn();
%>
<script language="JavaScript1.2">
var MCC = new Array(<%=dataArray.length%>);
<%for(int j =0; j < dataArray.length; j++){ %>;
MCC[<%=j%>]="<%=dataArray[j]%>";
<%}%>;
</script>
One more question:
I found on the web server, if I used the same file name (asp file and js file, html file is ok.), seems the server always used the old compiled codes ignoring the code already changed, even after re-complile. I have to change the file name again and again.
I worked on JDeveloper environment, it has a testing web server environment on my local, I am not sure if this situation will happen in the real server environment.
How can I make any new updates go into effect immidiately! Do you know web server has some configuration to handle this?
Thanks a gain!

Similar Messages

  • How to get the value in java script to JSP

    Hi,
    I have written an onclick function on each row and passing the primary key of the table to the javascript function. I want the value which I have passed to the javascript back in the jsp to delete the particular row. How can I achieve this.
    Thanks

    Thank you for your reply!! Here I am getting the values only into the javascript after I click a particular row in the table. So for the bean and action to get that particular vale I think I have to submit the form and then get the values back because its initially showing null. How do I submit the form and get the value back, so that I can delete particular row?

  • Share variable value between context

    Hello people !
    I need to refresh a variable from DB only once, at the beginning, from a GLOBAL context, and then, i need to evaluate that value from several other contexts, but the value must remain the same.
    Is that possible ?
    ps: asi es, soy argentino. Saludos !

    On the package I think is that possible. See # Oracle® Data Integrator - Reference Manual - 10g Release 3 (10.1.3)
    http://www.oracle.com/technology/products/oracle-data-integrator/10.1.3/htdocs/documentation/oracledi_reference.pdf
    Definition of an iterative loop
    To create a loop that repeats ten times, simply create a numerical variable, snp_increment, that
    contains the increment, then insert the following three steps:
    • Step 1 (Initializing loop): A Set Variable -type step which assigns '0' to snp_increment.
    • Step 2 (Increment loop): A Set Variable -type step which increments snp_increment by '1'.
    • Step 3 to n: …actions to execute in a loop n times.... The snp_increment variable can be
    used in these procedures.
    • Step n+1 (loop end test): An Evaluate Variable -type step which tests snp_increment<=10.
    If successful, execute the task: "step 2", if failed, execute the task: "<<next step>>"
    • Step n+2: .... next actions

  • Java script and jsp

    Hello all
    I want to call javascript function without any event from a jsp code, like following
    <script>
    function add(a,b,c){ alert("hello");}
    </script>
    jdbc connection code
    while(rs.next()
    a=rs.getInt("id");
    b=rs.getInt("id2");
    c=rs.getInt("id3");
    %>
    <script> add(<%=a %>,<%=b %>,<%=c %>);</script>
    can i do like this in jsp
    please help.

    Hi,
    You can do this in case if you put the data in request attribute.
    Regards,
    Sudheer Varma.

  • Passing vector between java class and jsp page

    Hi,
    I think this is similar to the last post but anyways maybe somebody can help us both out bontyh.....I am getting an error saying undefined variable or class when i try to access a Vector which was returned in a class.
    Anyways anyone got any ideas?

    Maybe if you give some more information...

  • Java code and jsp interaction

    Hi,
    How does one interact between java code and jsp page.That is, if the java code does say database connection, the web page should tell that the connection has been made,just like an application but this will work on the web server not in the console.Kindly let me know.
    As

    Just curious but where do these questions come from? A course you are taking or you are building something for a hobby?
    If you are building some small simple web-app it's probably quicker to embed code right onto your JSP page.
    There are various levels of abstracting your web-app separating display from logic from the model.
    The following are techniques from simple web-apps to more complicated ones.
    -Embedding script right into your JSP
    -Using beans
    -Using custom tags ( I think there are some standard ones now, struts seems to be a popular buzzword)
    -Including a servlet to handle your requests redirect, update bean content grab info form your database and forward to a JSP. (Read up on model 2 architecture.)
    To include as much detail as possible would be to write a book. Fortunately many have so I don't have to fit one in this tiny reply box.
    Hope that was somewhat useful.

  • Problem  in merging java script and java code

    hi,
    i want to merge java and javascript code but it is giving some surprising results.
    this is my code:
    <script language = "javascript">
    <%
    String query_result= "1";
    String buttontype="";
    buttontype=(String)session.getAttribute("buttontype");
    query_result = (String) session.getAttribute("query_result");
    out.println(query_result);
    if(buttontype!=null&&(buttontype.equals("submit")))
    out.println(buttontype);
    %>
    alert(<%=ka%>)
    </script>
    <%
    %>
    now if i'll move "<script language = "javascript">" to:
    <%
    String query_result= "1";
    String buttontype="";
    buttontype=(String)session.getAttribute("buttontype");
    query_result = (String) session.getAttribute("query_result");
    out.println(query_result);*/
    if(buttontype!=null&&(buttontype.equals("submit")))
    out.println(buttontype);
    %>
    <script language = "javascript">
    alert(<%=query_result%>)
    </script>
    <%
    %>
    then it prints correctly and gives alert "1" but if i'll change query_result="manish" then it is not giving alert also
    i don't know wht is happening
    plz help me out
    manish

    hi pgeuen,
    Thanx for ur reply
    now its working i have changed my jsp exp. tag to
    alert("\"<%=ka%>\"")
    and it is displaying correctly.
    and if i'll give the scripting tags in "if block"then it will work but till now i didn't get why i was not getting any output when the scripting tags covers the whole jsp code. i think we can mix java script and jsp in any way.
    well thanx a lot.
    manish

  • What're the differences between JSP, Java Script, and Java Applet?

    I am confused by the concepts: JSP (Java Server Page), Java Script, and Java Applet? What are their main differences?

    I don't know about differences, but one of their main similarities is that each of them has a page in Wikipedia.
    JSP
    JavaScript
    [Java applet|http://en.wikipedia.org/wiki/Java_applet]
    There. That should give you enough information.

  • Sharing complex substitution variable values between ASO and BSO databases

    We have ASO and BSO Essbase database member names with spaces in, and need to store some of these member names in substitution variables. However, this has to be done differently for ASO and BSO, due to calc script syntax requiring double quotes and MDX requiring square brackets. For example:
    ASO:
    &CurWeek value = Week 1
    MDX: [&CurWeek]
    BSO:
    &CurWeek value = "Week 1"
    Calc Script: &CurWeek
    As a result, the substitution variables cannot be shared between the ASO and BSO cubes, since the BSO variable value requires double quotes due to the space in the member name.
    Is there a way to get the above to work with both ASO and BSO? Can the double quotes be escaped in calc script syntax? Or can the double quotes be removed in the MDX formula?

    Hi TimG,
    Apologies for such a late reponse to this, genuinely haven't had a spare second to reply until now!
    Yes, I suspect a complex alias name may be the best solution here, and to remove the spaces from the actual member names.
    I was not aware of the latter part at all. My colleague has confirmed as much on this too - DBAG 11.1.2.1 pp117 & 118:
    "Note: If a substitution variable value is numeric or a member name starting with a
    numeral or containing the special characters referred to above is to be used both
    in MDX and non-MDX situations, create two substitution variables, one without
    the value enclosed in quotation marks and one with the value in quotation marks."
    "To ensure that a new substitution variable value is available in formulas, partition definitions,
    and security filters, stop and restart the application. All other uses of substitution variables are
    dynamically resolved when used."
    This last paragraph is the most concerning since we were planning to be able to update substitution variables values and then access the new values from calc scripts and formulae instantaneously. This quirk is unexpected and a little inconvenient. We may have to look at scheduling a change of substitution variable value overnight, followed by a stop/start of the app ready for the next day, and to work around needing to access changed values instantly.

  • How to interchange data between Java Program and C++ Program

    I constructed a java program using netbeans IDE that has ability to connect with a respective DLL; I want to connect and interchange data between my java program(.jar) and VSC++ program(.exe) through DLLs.JNI uses single Dll to invoke C/C++ function in native manner,In order to increase the efficiency I tried to connect and interchange primitive data types between Java program and C++ program using that DLL(JNI implemented).
    Unfortunately C++ program cannot obtain data values that has been changed by Java Program.For example - If I declare a global int variable in DLL,java program can catch that int variable and can update it but If I run my C++ program(exe) loading same DLL simultaneously it cannot receive the updated value of that int variable declared in the DLL.
    Therefore I need a solution to share/Interchange at least primitive data and their respective values between a JAVA and C++ Program using JNI (in spite of date transferring through Sockets).JAVA TO C/C++ & C/C++ to JAVA using DLLs.
    (TWO WAY COMMUNICATION)
    JAVA.jar  <=> <JNI> <=> DLL <=> [Connector Program C/C++] <=> C/C++ .exe
    PLEASE HELP ME!! THANK YOU

    What in the are you trying to say? What does "filled into the servlet mean?" Is the map somewhere outside the servlet? In a different process? Are you asking how to extract data from a map? Something else?
    Sorry, but your question makes no sense.

  • Java script with jsp

    hello friends,.
    please help me !! May i know how to retrieve values from list box in java script to jsp and store them in database..i am doing a project Employee Management system....
    please give me ideas .....

    thank you very much sir.......
    i have a combo box in java script having employee skills, if the employee select his skills and click on submit, the values should be stored in the database of the particular employee through JSP..
    the code that i have did is...
    <%
    String s1=(String)session.getAttribute("eid");
    String s2[]=request.getParameterValues ("menu2");
    int i=0;
    %>
    <%
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:empl2");
    PreparedStatement prep=con.prepareStatement("update skill(menu2) values(?) where eid=?");
    // prep.setString(1,s2);
    prep.setString(2,s1);
    i=prep.executeUpdate();
    con.close();
    catch(Exception e)
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body >
    <center><h4><u> Employee Assessment Application</u></h4></center>
    <%
    if(i>0)
    %>
    Your skills had been updated !!!!!
    <%
    else
    %>
    not updated
    <%
    %>
    <br>Best of Luck
    <h4><u>Back</h4>
    </body>
    </html>
    But the values are not getting stored....what to do
    thanx in advance

  • Setting bind variable value programmatically for master and child VO's

    Defined following BC:
    Serv VO - Master VO, has Bind_cNum (bind variable)
    ServDetail VO - Child VO, has Bind_cNum2 (bind variable)
    ServViewLink VL - View link between Serv VO & ServDetail VO
    in AMModule Impl have custom WS:
    public List<ViewRowImpl> getMyServices(String cNum)
    List<ViewRowImpl> result = new ArrayList<ViewRowImpl>();
    ViewObjectImpl vo1 = getServ(); //Master VO
    vo1.setNamedWhereClauseParam("Bind_cNum", cNum);
    vo1.setForwardOnly(true);
    ViewObjectImpl vo2 = getServDetail(); //Child VO
    vo2.setNamedWhereClauseParam("Bind_cNum2", cNum);
    vo1.executeQuery();
    while (vo1.hasNext()) {
    result.add((ViewRowImpl)vo1.next());
    return result;
    I am passing same cNum parameter to both Serv VO (Master VO) and ServDetail VO (child VO) as above. (this is in addition to view link bind variable :Id)
    It shows in the logs that it is setting the values correctly:
    <ViewRowSetImpl> <setNamedWhereClauseParam> [382] Serv ViewRowSetImpl.setNamedWhereClauseParam(Bind_cNum, 11771370)
    <ViewRowSetImpl> <setNamedWhereClauseParam> [383] ServDetail ViewRowSetImpl.setNamedWhereClauseParam(Bind_cNum2, 11771370)
    <ViewRowSetImpl> <doSetWhereClauseParam> [383] Serv ViewRowSetImpl.doSetWhereClause(-1, Bind_cNum, 11771370)
    <ViewRowSetImpl> <execute> [385] Serv ViewRowSetImpl.execute caused params to be "un"changed
    <OracleSQLBuilderImpl> <bindParamValue> [394] Binding param "Bind_cNum": 11771370
    <ADFLogger> <addContextData> Execute query
    -- when executing view link
    <ViewRowSetImpl> <setParamValues> [425] ServViewLink_0 ViewRowSetImpl.setParamValues params changed
    <ViewRowSetImpl> <doSetWhereClauseParam> [426] ServViewLink_0 ViewRowSetImpl.doSetWhereClause(-1, Bind_cNum2, null)
    <ViewObjectImpl> <bindParametersForCollection> [436] For RowSet : ServViewLink_0
    <OracleSQLBuilderImpl> <bindParamValue> [437] Binding null of type 12 for "Bind_cNum2"
    <OracleSQLBuilderImpl> <bindParamValue> [438] Binding param "Bind_Id": 5018
    from above log, when ServViewLink_0 is executed, it is changing Bind_cNum2 bind variable to null.
    how can i pass same bind variable value to both Master and Child view objects from AM Impl.java
    Edited by: bsrao on Oct 11, 2012 6:07 PM
    Edited by: bsrao on Oct 11, 2012 6:10 PM
    Edited by: bsrao on Oct 11, 2012 6:12 PM

    Try executing the vo1 query before setting the bind variable for vo2, then execute the vo2 query (if that's what you want to do).

  • Compatibility between Java crypto and open ssl

    Hello
    I have some question about compatibility between java crypto and openssl library.
    This is my case:
    1.I created DESede key and stored it to file:
    SecretKey key = KeyGenerator.getInstance("TripleDES").generateKey();
    File f = new File("c:\\key.dat");
    DataOutputStream dos =new DataOutputStream(new FileOutputStream(f));
    dos.write(key.getEncoded());
    dos3.close();2.I encrypt some file "c:\\normal.dat" through:
    ecipher.init(Cipher.ENCRYPT_MODE, key2);
      byte[] enc = ecipher.doFinal(normalData);
      File f2 = new File("c:\\enc.dat");
      DataOutputStream dos =new DataOutputStream(new FileOutputStream(f2));
      dos.write(enc);
      dos.close();

    You have carefully left out some critical java code, namely the Cipher.getInstance() method. You'll notice in the documentation for this method that there 3 components to the "transform" argument of this method, the algorithm, the mode, and the padding. All of these must match exactly with the what openssl is using. Furthermore, if you are using one of the modes which require an IV, like CBC mode, then this must match exactly too. If you don't explicitly specify some of these parameters, you might get default values supplied. It is up to you to find out what these are.

  • Problem in picking the system variable value in Calculation Script

    Hi All,
    We are using a Calculation Script to perform data export. And the target location where to crete the exported output file is given to the environment system variable.
    Now I am using this system variable in the calculation script as below:
    //ESS_LOCALE English_UnitedStates.Latin1@Binary
    SET DATAEXPORTOPTIONS
    DataExportLevel "ALL";
    DataExportOverwriteFile ON;
    Fix ( &CurrMiles, &CurrProj, &CurrVer,"No Project","No Version")
    DATAEXPORT "File" " " $DEXPORTPATH;
    ENDFIX
    Here "DEXPORTPATH" is the system variable
    I am creating this system variable from the batch script and the system variable value varies at the runtime.
    This calculation script works fine for first time and it picks the correct value from the system variable.
    But the problem occurs from next execution of calc script. Even if i update the system variable with other value, it picks only the last execution system variable value and it performs execution.
    Eg: Suppose for first execution system variable value is "D:\Bkup\PMV.txt"
    The calc script works fine with this.
    For next execution, system variable value is changed to "D:\Time\temp.txt"
    Now the calc script picks the system variable value as "D:\Bkup\PMV.txt"
    and performs execution which is wrong.
    Please help me on this issue how to handle system variables in calc scripts.
    Thanks in advance
    Regards
    Swathi

    811829 wrote:
    Hi All,
    We are using a Calculation Script to perform data export. And the target location where to crete the exported output file is given to the environment system variable.
    Now I am using this system variable in the calculation script as below:
    //ESS_LOCALE English_UnitedStates.Latin1@Binary
    SET DATAEXPORTOPTIONS
    DataExportLevel "ALL";
    DataExportOverwriteFile ON;
    Fix ( &CurrMiles, &CurrProj, &CurrVer,"No Project","No Version")
    DATAEXPORT "File" " " $DEXPORTPATH;
    ENDFIX
    Here "DEXPORTPATH" is the system variable
    I am creating this system variable from the batch script and the system variable value varies at the runtime.
    This calculation script works fine for first time and it picks the correct value from the system variable.
    But the problem occurs from next execution of calc script. Even if i update the system variable with other value, it picks only the last execution system variable value and it performs execution.
    Eg: Suppose for first execution system variable value is "D:\Bkup\PMV.txt"
    The calc script works fine with this.
    For next execution, system variable value is changed to "D:\Time\temp.txt"
    Now the calc script picks the system variable value as "D:\Bkup\PMV.txt"
    and performs execution which is wrong.
    Please help me on this issue how to handle system variables in calc scripts.
    Thanks in advance
    Regards
    SwathiAs of my knowledge system variables will not update immediately...you need to log off the session after changing the value.
    Update the system variable..
    Log off from the session..
    And Re-login with the same username ....and check...
    Regards,
    Prabhas

  • Problem exchanging values between a Servlet and Thread???

    Hi Everybody,
    I have got a problem exchanging values between a Servlet and a Thread...
    The actual thing will go like this
    I take a request from JSP which is served by a servlet..
    A thread is invoked in the servlets into which the parameter values taken from JSP page is sent...
    In between the thread needs to be suspended for a moment, relieve the control back to the servlet and then come back with the new values modified in the servlet...
    How is this achieved?
    Please give ur suggestions regarding this...
    Thanks in advance

    I really have no clue how you can use URLConnection to do that!
    Could you please explain in the following scenario how it can help me as an alternative solution to the following:
    Non-Servlet A continously running & saving to some prop regularly
    --> servlet B reads prop file regularly --> display continously on a jsp file
    I wish I could do a servlet A --> servlet B-- > display jsp scenario but I do not know how to have servlet A continously running while keep the servlet B interacting with the jsp.

Maybe you are looking for

  • Video show disaapears when connecting to pc...

    Everytime I connect my Ipod to my pc one of my video shows disappears from my Ipod, not from my Itunes. Waht is going on? How do I get them back on, I have a 30 gb.

  • Using new DJ function in iTunes with Apple TV

    Ideally, wouldn't it be great to be able to stream the new DJ function in iTunes to an Apple TV which is wired into my home stereo systems? Then I would be able to control an entire house from my kitchen iMac. Now THAT would be a party! I am successf

  • No music option in settings???

    how can I retrieve???

  • Why font styles fail to work

    I am using Windows 7. In Indesign 5.0 some fonts do not appear with their styles. For example, a particular font has 4 variants (Normal, Bold, Bold Italic and Italic). But only one style appears in Indesign. I have tried to put all the four fonts in

  • Accessing third party code from JNI. URGENT !!!!

    Hi, I have to use a .so library (Solaris) from another company. As this library has not the correct syntax to be accessed from JNI, I made another .so that calls it. For compile this library I just need the header file and I can compile it succesfull