Passing vars...JSP resolves faster than javascript - is there a workaround?

HI
The variable/value ("fieldA") that I want to pass from "frame1.jsp" to "frame2.jsp is actually a variable defined javascript function "getTest()" in "frame1.jsp".
I want to pass "fieldA" from "frame1.jsp" to "frame2.jsp"..
"frame2" is initially "blank.html. In the "getTest()" function I use (parent.frames[2].location = "frame2.jsp";) to create frame2.jsp inside of "frame2"
I generat a "post" request (from "frame1.jsp") assigning "fieldA" to a hidden form field ("fldA") in "frame2", and then display the value of "fldA" using "<%= request.getParameter("fldA") %>"...
But the value of hidden form field - "fldA" - is initially "null" because when "frame2.jsp" page is creatd, the JSP scriplets resolve before the javascript "getData" function can resolve. (if I click to post frame2.jsp again, the value shows - but, that's just because the frame2.jsp now exists.)
Is there a work around?.... Or, do I need to have "frame1.jsp" call a servlet to pass "fieldA" ????
Appreciate ANY help on this!!!!
(NOTE -- actually, my real world need will be to assign the value to a Custom Tag parameter, rather than simply display - and that is why I need to get this to work!)
THE WORKING CODE IS BELOW. . . (AGAIN ANY HELP IS APPRECIATED!)
*****frame0.html*****
<%@ page language="java" import="java.io.*, java.util.*" errorPage="error.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>frame0</TITLE>
</HEAD>
<FRAMESET FRAMEBORDER="2" ROWS="20%,80%">
<FRAME SRC="frame0.html" NAME="frame0">
<FRAMESET FRAMEBORDER="2" COLS="20%,80%">
<FRAME SRC=frame1.jsp?fieldX=<%= session.getParameter("fieldX") %> NAME="frame1">
<FRAME SRC=frame2.jsp?fieldX=<%= session.getParameter("fieldX") %> NAME="frame2">
</FRAMESET>
</FRAMESET>
</HTML>
*****frame1.jsp*****
<%@ page language="java" import="java.io.*, java.util.*" errorPage="error.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
     <head><title>frame1</title>
     <link rel="stylesheet" type="text/css" href="./standard.css">
          <script LANGUAGE="JavaScript">
               parent.frames[2].location = "blank.html";
               function getTest()
                    var fieldA = "HO THERE!!!"
                    <%
                         session.putValue("fieldB", "HEY THERE!!!");
                    %>
                    parent.frames[2].location = "frame2.jsp";
                    parent.frames[2].getData(fieldA);
                    return;
</script>
     </head>
     <body bgcolor="#FFFFFF" text="#000000">
          <p>
          <h2>
          In frame1.jsp, the value in fieldA is: <%= session.getAttribute("fieldA") %>
          <h2>
          In frame1.jsp, the value in fieldB is: <%= session.getAttribute("fieldB") %>
          <p>
          <form name="reportRange">
               <center>
                    <fieldset style="padding: 0.5em" name="customer_box">
                    <table cellpadding="0" cellspacing="0" border="0">
                         <tr class="drophead">
                              <td valign="top" height="0" ><span class="drophead">
                                   test submit
                              </td>
                         </tr>
                    </table>
                    </fieldset>
               </center>
          </form>
     </body>
</html>
*****frame2.html*****
<%@ page language="java" import="java.io.*, java.util.*" errorPage="error.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
     <head>
     <title>frame2</title>
          <script LANGUAGE="JavaScript">
               function getData(fieldA)
               document.pageData.fldA.value = fieldA;
                    document.pageData.submit();
          </script>
     </head>
     <body>
          <p>
          <h2>
          In frame2.jsp, the value of fieldA: <%= request.getParameter("fldA") %>
     <h2>
          In frame2.jsp, the value of fieldB: <%= session.getValue("fieldB") %>
          <p>
          <div id="HiddenForm">
               <form name="pageData" method="post" action="frame2.jsp" target="_self">
                    <input type="hidden" name="fldA" value="empty">
               </form>
          </div>
     </body>
</html>
*****blank.html*****
<html>
<head>
<title>blank page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="globalview.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
</body>
</html>
*****error.jsp*****
<%-- error.jsp --%>
<%@ page language="java" isErrorPage="true"%>
<html>
<head>
     <title>error page</title>
</head>
<body>
<h2>Error Encountered: </h2>
<%= exception.toString() %><BR>
<br>
details...<%= exception.getMessage() %>
</body>
</html>

So where to start...
1) session does not have a method "getParameter()" (frame0.jsp) so I don't know how you can get this to work.
2) When you call "javascript:getTest()" the scriptlet is not run again. It's serverside so it is execute on the server then any return data is placed where you have the scriptlet.
3) The scriptlets in "frame0.html" will not work as the page is declared as html.
4) Once again jsp scriptlets (including TagLibraries) are server side components. Any values passed to them should be via a request or session setting on the server side.
For example:
Say we have a tag "myWorkingTag" that outputs the value we assign to "valToUse" on the page.
original jsp document (page.jsp):
<%@ taglib uri="mytags" prefix="mine" %>
<html>
<body>
<mine:myWorkingTag valToUse="xyz"/>
</body>
</html>
The web browser view of page.jsp:
<html>
<body>
xyz
</body>
</html>
You can assign the "valToUse" attribute using <%="xyz"%> (or session.getAttribute() or request.getParameter()) on the server side but ultimately you need to send the value to the server and recompile the page.
I've made some changes to your code (in bold) which is a minor fix but not a solution to your overall objective.
***** frame0.jsp *****
<HTML>
<HEAD>
<TITLE>frame0</TITLE>
</HEAD>
<FRAMESET ROWS="20%,80%">
<FRAME SRC="frame0.jsp" NAME="frame0">
<FRAMESET COLS="20%,80%">
<FRAME SRC=tFrame1.jsp?fieldX=<%= request.getParameter("fieldX") %> NAME="frame1">
<FRAME SRC=tFrame2.jsp?fieldX=<%= request.getParameter("fieldX") %> NAME="frame2">
</FRAMESET>
</FRAMESET>
</HTML>
***** frame1.jsp *****
<%@ page language="java" import="java.io.*, java.util.*" errorPage="error.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head><title>frame1</title>
<link rel="stylesheet" type="text/css" href="./standard.css">
<script LANGUAGE="JavaScript">
//parent.frames[2].location = "blank.html";
function getTest()
var fieldA = "HO THERE!!!"
<%session.setAttribute("fieldB", "HEY THERE!!!");%>
parent.frames[2].location = "frame2.jsp";
parent.frames[2].getData(fieldA);
return;
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>
<h2>
In frame1.jsp, the value in fieldA is: <%= session.getAttribute("fieldA") %>
<h2>
In frame1.jsp, the value in fieldB is: <%= session.getAttribute("fieldB") %>
<p>
<form name="reportRange">
<center>
<fieldset style="padding: 0.5em" name="customer_box">
<table cellpadding="0" cellspacing="0" border="0">
<tr class="drophead">
<td valign="top" height="0" ><span class="drophead">
test submit
</td>
</tr>
</table>
</fieldset>
</center>
</form>
</body>
</html>
*****frame2.jsp*****
<%@ page language="java" import="java.io.*, java.util.*" errorPage="error.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>frame2</title>
<script LANGUAGE="JavaScript">
function getData(fieldA)
document.pageData.fldA.value = fieldA;
document.pageData.submit();
</script>
</head>
<body>
<%if(request.getParameter("fldA")!=null){
//this section doesn't make sense, your using the same value twice!?!%>
<p>
<h2>
In frame2.jsp, the value of fieldA: <%= request.getParameter("fldA")
%>
<h2>
In frame2.jsp, the value of fieldB: <%= session.getAttribute("fieldB") %>
<p>
<%}%>
<div id="HiddenForm">
<form name="pageData" method="post" action="frame2.jsp" target="_self">
<input type="hidden" name="fldA" value="empty">
</form>
</div>
</body>
</html>
***** blank.html (obsolete) *****
***** error.jsp unchanged *****
What you should be aiming for is either:
A) Using the above code, send all your required parameters to the form in frame2.jsp and use these parameters to configure the page. As you can see I added an "if(request.getParameter("fldA")!=null)" block to prevent any code from being execute until you send the data.
B) In frame1.jsp, submit it to itself with all the parameters you need and add the objects to the session. When frame1.jsp returns the page to the browser, get it to call a javascript function (<body onload='...'>") to reload frame2.jsp and collect the objects/variables from the session.
Just remember Javascript and Java in JSP's don't exist in the same "world" so to speak. They have to cross a bridge to communicate, the bridge being the action of the form.
Cheers,
Anthony

Similar Messages

  • How JSP is faster than Servlets ??????

    can anyone tell me why and how jsp is faster than servlets.
    i want the detailed description of this question.
    thanks in advance..

    Hi simmy1,
    The performance of JSP pages is very close to that of servlets. However, users may experience a perceptible delay when a JSP page is accessed for the very first time. This is because the JSP page undergoes a "translation phase" wherein it is converted into a servlet by the JSP engine. Once this servlet is dynamically compiled and loaded into memory, it follows the servlet life cycle for request processing. Here, the jspInit() method is automatically invoked by the JSP engine upon loading the servlet, followed by the _jspService() method, which is responsible for request processing and replying to the client. Do note that the lifetime of this servlet is non-deterministic - it may be removed from memory at any time by the JSP engine for resource-related reasons. When this happens, the JSP engine automatically invokes the jspDestroy() method allowing the servlet to free any previously allocated resources.
    Subsequent client requests to the JSP page do not result in a repeat of the translation phase as long as the servlet is cached in memory, and are directly handled by the servlet's service() method in a concurrent fashion (i.e. the service() method handles each client request within a seperate thread concurrently.)
    I hope this will help you out.
    Regards,
    TirumalaRao.
    Developer TechnicalSupport,
    Sun Microsystems,India.

  • Unable to bootup after Yosemite install. have to keep shutting down from rear button. it does come on after a few times but then hangs at user login again. If you get in it is great. Seems faster than Mavericks but there is some sort of issue, bouts

    unable to bootup after Yosemite install. have to keep shutting down from rear button. it does come on after a few times but then hangs at user login again. If you get in it is great. Seems faster than Mavericks but there is some sort of issue, bootup /login.

    Knock on wood, this seems to have been my problem as well.  I stumbled on this thread after dealing with this ridiculously-long boot times for the past several weeks.
    I just reinstalled McAfee Antivirus and my Macbook Air booted up in less than 1 minute.  No more hanging on the boot-up progress bar.  No more hanging after I click on my user's avatar on the log-in screen.  Bootup would often take 5+ minutes and sometimes never complete.
    This has been SUPREMELY frustrating.
    THANK YOU SO MUCH FOR POSTING YOUR RESPONSE!!!

  • How to pass a jsp variable into javascript??

    <p><%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <p><%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    <p><html>
    <p><c:set var="binrmapi" value="http://localhost/paas-api/bingorooms.action;jsessionid=XXXXXX?userId=TEST2&sessionId=1&key=1" />
    <p><c:import var="testbinrm" url="${fn:replace(binrmapi, 'XXXXXX', jsessionid)}"/>
    <p><c:set var="tuples" value="${fn:split(testbinrm, '><')}" />
    <p>Time until next game
    <p><c:forEach var="tuple" items="${tuples}">
    <p><c:if test="${fn:contains(tuple, 'row ')}">
    <p> <p><code>
    <p> <c:set var="values" value="${fn:split(tuple, '=\"')}" />
    <p> <font color="blue">
    <p> <c:out value="${values[17]}" />
    <p><c:set var="remainingtime" value="${values[17]}" />
    <p> </font>
    <p> </code>
    <p></c:if>
    <p></c:forEach>
    <p><form name="counter"><input type="text" size="8" name="d2"></form>
    <p><script>
    <p>var milisec=0
    <p>var seconds=eval("document.myForm.remaining").value;
    <p>function display(){
    <p> if (milisec<=0){
    <p> milisec=9
    <p> seconds-=1
    <p>}
    <p>if (seconds<=-1){
    <p> milisec=0
    <p> seconds+=1
    <p> }
    <br>else
    <p> milisec-=1
    <p> document.counter.d2.value=seconds+"."+milisec
    setTimeout("display()",100)
    <p>}
    <p>display()
    <p></script>
    <p></body>
    <p></html>
    <p>This is my code that i was working on, in the jsp part of the script, i get a api call and save a value of time in the variable remainingtime.. and in the javascript, i try to have a countdown clock counting down the remaining time.. but i guess it doesnt work.. how can i get that working? thanks alot
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001

    Re: How to pass a jsp variable into javascript??Here is the sameple one, hope it will solves your problem.
    <html>
    <body>
    <form name=f>
    <%!
    String str = "A String"
    %>
    <script>
    var avariable = <%=str%>
    <script>
    </form>
    </body>
    </html>
    Let me know if you face any problem

  • Is JSP faster than ASP?

    I want to know whether JSP Runtime Environment is faster than ASP. It will be very helpfull if i get any benchmark reports. AuRevoir!

    id suggest you do it yourself, no-one is going to write up this sort of stuff without you paying for it
    in any case i'd dare to suggest that asp would be faster than jsp ( running on different servers no doubt; but given both windows os's ) because asp is basically vbscript which i imagine would be faster for the server to compile given a win box than jsp -> jvm -> server -> client ( if thats even how it works. ).
    my opinion...

  • How to pass a JSP var to a Script function called in a netui:checkbox

    How to pass a JSP variable to a Java Script function called in a netui:checkbox onSelect?
    I have a requirement where based on the checkBox selected or deselected in a repeater tag I would have to select or deselect other checkboxes in a netui:form. I am trying to pass the index or unique name of the checkbox to the JavaScript function. When I try this code I am getting a Syntax Error!! and getting a " item undefined" in the javascript. This works when I use just the html form tag but when I use the <netui:form> tag I am facing this issue. Any help would be highly appreciated.
    function selectACheckBoxOnClick(name) {
    alert ("called selectACheckBoxOnClick ");
    alert ("called name "+name);
    <netui-data:repeater dataSource="{pageFlow.unregisteredContractAssetsDTOArr}">
    <netui-data:repeaterItem>
    <% String checkboxName = "selectACheckBox_"+i;
    String serialNum = "serialNum_"+i;
    String hidenboxName = "hiddenACheckBox_"+i;
    String loopNo = new Integer(i).toString();
    System.out.println("Loop String :"+ loopNo);
    System.out.println("CheckBox Name:"+ checkboxName);
    System.out.println("serialNum :"+serialNum); %>
    <tr bgcolor="#ffffff">
    <td align="center">
    <netui:checkBox dataSource="{container.item.selectedAssetFlag}" onSelect="selectACheckBoxOnClick(<%=checkboxName%>);" tagId="<%=checkboxName%>"/>
    </td>
              <td class="small"><netui:label value="{container.item.model}"/></td>
              <td class="small">
    <netui:hidden dataSource="{container.item.splitAssetNo}" tagId="<%=serialNum%>"/>
    <netui:label value="{container.item.serial}"></netui:label></td>
              <td class="small"><netui:label value="{container.item.equpimentId}"/></td>
              <td class="small">
    <netui-data:getData resultId="siteId" value="{container.item.siteNo}" />
    <%String siteId = (String) pageContext.getAttribute("siteId");%>
    <netui:anchor action="getSiteLevelAssets" formSubmit="true">
    <netui:parameter value="{container.item.siteNo}" name="siteNo" />
    <netui:label value="{container.item.siteNo}" />
    </netui:anchor>
    </td>     </tr>
    <%i++;%>
    </netui-data:repeaterItem>
    </netui-data:repeater>
    This code works within a form:
                   <td align=center>
                        <input type=image name="unassign" onclick="javascript:unassignReplacement(<%=replacementSupply.getPMSupplyId()%>)" src="<%=request.getContextPath()%>/images/bt_sm_x.gif" border=0 alt="Unassign">
                        </td>
    Thanks,
    Salome

    hi
    i did not go thru your code completly
    but u can use the following for your problem
    the checkbox in the repeater must have unique TagID
    counter = 0; (initialize)
    <netui-data:repeaterItem>
    <netui:checkBox dataSource="" tagId='<%="count"+String.valueOf(counter)%>' onClick="some function()" />
    <%counter++;%>
    </netui-data:repeaterItem>
    here if u have 3 checkbox
    They will have Tagid's as count1 , count2 and count3
    now in the javascript somefunction()
    use the following line
    for(j=0;j<<%=counter%>;j++)
    document.forms(0)[getNetuiTagName"count"+j)].checked=false;     
    }

  • I understand that a XSL transformation is faster than JSP

    Hi all
    let's say the datasource solution provides data ,
    I'm under the impression that you can make the XSL loop through the information do various logic on the data and represent the data much faster than can be accomplished with JSP
    Is there anyone else out there that understands the same ?
    stev

    I tend to doubt it. The XSL is interpreted (well, usually) where as the JSP is compiled. Sure, you can write really bad JSP code that underperforms really good transforms, but I'd tend to believe that in general it would be faster than XSL.
    That said, XSL can provide for greater flexibility than JSP rendering and that may be easily worth any small performance penalty it may have.
    Chuck

  • JSP response into a Javascript code

    Suppose I have a form that I submit, and its action is set to a JSP page that returns a series of elements <option>, for example:
        <option>2005</option>
        <option>2006</option>
    Is it possible to GET that JSP response, inside the JavaScript code?
    Or should I better state, inside the JSP code, to return ONLY the numbers and then I get it on the JavaScript and use the .add() funtion to add the item to a <select> ?
    How do I save that response inside the JavaScript?
    For example, I am trying with this Javascript function that handles the changes on a drop-down list:
      function clickedOnPType(lista)
      document.form1.action = "searchAvailableYears.jsp?pType=" + txtPType;}
      document.form1.submit();
    }...And I am getting, in return, a series of <option> with the correct data...
    Thanking you in advance,
    MMS

    Oh hello... in one of my 1000 searches I found that
    post days ago and I was already trying with your
    code, but I was getting several errors like
    "undefined is null or not an object" (in IE),
    "xmlhttp.responseXML has no properties" (in
    Firefox).... Well one thing i wanted to discuss here is is wat properties does in general a XmlHttpRequest Object contains
    checkout the below interface which gives a clear understanding of the Object member properties.
    interface XMLHttpRequest {
      attribute EventListener   onreadystatechange;
      readonly attribute unsigned short  readyState;
      void  open(in DOMString method, in DOMString url);
      void  open(in DOMString method, in DOMString url, in boolean async);
      void  open(in DOMString method, in DOMString url, in boolean async, in DOMString user);
      void  open(in DOMString method, in DOMString url, in boolean async, in DOMString user, in DOMString password);
      void  setRequestHeader(in DOMString header, in DOMString value);
      void  send();
      void  send(in DOMString data);
      void  send(in Document data);
      void  abort();
      DOMString  getAllResponseHeaders();
      DOMString  getResponseHeader(in DOMString header);
      readonly attribute DOMString  responseText;
      readonly attribute Document   responseXML;
      readonly attribute unsigned short  status;
      readonly attribute DOMString  statusText;
    };therefore as you can see XmlHttpRequest.reponseXML returns a Document Object which has below set of properties.
    http://www.w3schools.com/dom/dom_document.asp
    http://www.javascriptkit.com/domref/documentproperties.shtml
    and as said earlier one can send AJAX response in three ways
    1).Plain text(with comma seperated values maybe): Which we can collect using XmlHttpRequest.responseText 2).XML: @ client side XmlHttpRequest.reponseXML create a DOM Object using which one can parse it get values
    of attributes and values of different tags and then update the view accordingly.
    3).JSON(Javascript Object Notation): It is a bit complicated thing to discuss at this moment
    however it uses the first property(Plain text) and then
    uses set of libraries to parse and update the view.
    checkout below links to understand it
    http://www.ibm.com/developerworks/library/j-ajax2/
    http://oss.metaparadigm.com/jsonrpc/
    >  function handleOnChange(ddl)
    >
    var ddlIndex = ddl.selectedIndex;
    var ddlText = ddl[ddlIndex].text;
    var frmSelect = document.forms["form1"];
    var frmSelectElem = frmSelect.elements;
    if(ddl.name="pType")
         txtYear = "";
    txtDay = "";
              txtTime = "";
              unblock(document.form1.year);
              block(document.form1.day);
              block(document.form1.time1);
         laProxLista = frmSelectElem["year"];
    if (ddl.options[ddl.selectedIndex].text !=
    txtPType = ddl.options[ddl.selectedIndex].text;
    else if(ddl.name="year")
         txtDay="";
         txtTime="";
              unblock(document.form1.day);
              block(document.form1.time1);
    laProxLista = frmSelectElem["day"];
    f (ddl.options[lista.selectedIndex].text != "---")
    txtYear = ddl.options[lista.selectedIndex].text;
    else if(ddl.name="day")
    {          txtTime = "";
              unblock(document.form1.time1);
    laProxLista = frmSelectElem["time1"];
    (ddl.options[ddl.selectedIndex].text != "---")
    txtDay = ddl.options[ddl.selectedIndex].text;
    else //time1
    laProxLista = null;
    if (ddl.options[ddl.selectedIndex].text != "---")
    txtTime1 = ddl.options[ddl.selectedIndex].text;
    if ( txtPType != "---")
    xmlhttp = null
    // code for initializing XmlHttpRequest
    Object On Browsers like Mozilla, etc.
    if (window.XMLHttpRequest){ 
    xmlhttp = new XMLHttpRequest()
    // code for initializing XmlHttpRequest
    Object On Browsers like IE
    else if (window.ActiveXObject) { 
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttp != null)
    if(ddl.name = "pType")
    // Setting the JSP/Servlet url to get
    XmlData
    url = "searchAvailableYears.jsp?pType="
    + txtPType;
                   else if(ddl.name = "year")
    url = "searchAvailableDOY.jsp?pType=" + txtPType
    PType + "&year=" + txtYear;
                   else(ddl.name = "day")
    url = "searchAvailableTimes.jsp?pType=" +
    e=" + txtPType + "&year=" + txtYear + "&day=" +
    txtDay;
    xmlhttp.onreadystatechange =
    handleHttpResponse;
    // Open the Request by passing Type of
    Request & CGI URL
    xmlhttp.open("GET",url,true);
    // Sending URL Encoded Data
    xmlhttp.send(null);
    else{
    // Only Broswers like IE 5.0,Mozilla & all other
    browser which support XML data Supports AJAX
    Technology
    // In the Below case it looks as if the
    browser is not compatiable
    alert("Your browser does not support
    XMLHTTP.")
    } //else
    } //if chosen
    //function
         //----------------------------Well as far as i can see i do not have any issues with it because your code looks
    preety much involved with your business logic but one thing i would like to reconfim
    here is the variable "xmlhttp" a global one.
    if no declare xmlhttp variable as a global variable.
    <script language="javascript">
    var xmlhttp;
    function handleOnChange(ddl){
    function verifyReadyState(obj){
    function handleHttpResponse() {
    </script>
    > function verifyReadyState(obj)
    if(obj.readyState == 4){
    if(obj.status == 200){
    if(obj.responseXML != null)
    return true;
    else
    return false;
    else{
    return false;
    } else return false;
    }I believe,this is preety much it.
    > function handleHttpResponse() [/b]
    if(verifyReadyState(xmlhttp) == true)
    //-----------HERE!! ---- I GET "UNDEFINED" IN THE
    DIALOG BOX
    //------- BELOW THE CODE LINE....---
    var response = xmlhttp.responseXML.responseText;
    alert(response);
    it is obvious that you would get Undefined here as responseText is not a property of Document Object or to be more specific to the Object what xmlhttp.responseXML returns.
    you might have to use that as alert(xmlhttp.responseText);
    and coming back to parsing the XML reponse you have got from the server we need to use
    var response = xmlhttp.responseXML.documentElement; property for it...
    and if you put as a alert message it has to give you an Output like"Object"
    alert(response);
    if that doesn't the browser version which you are using may not support XML properly.
    var response = xmlhttp.responseXML.documentElement;
    removeItems(laProxLista);
    var x = response.getElementsByTagName("option")
      var val
      var tex
      var newOption
                  for(var i = 0;i < x.length; i++){
                     newOption = document.createElement("OPTION")
                     var er
                     // Checking for the tag which holds the value of the Drop-Down combo element
                     val = x.getElementsByTagName("value")
    try{
    // Assigning the value to a Drop-Down Set Element
    newOption.value = val[0].firstChild.data
    } catch(er){
    // Checking for the tag which holds the Text of the Drop-Down combo element
    tex = x[i].getElementsByTagName("text")
    try{
    // Assigning the Text to a Drop-Down Set Element
    newOption.text = tex[0].firstChild.data
    } catch(er){
    // Adding the Set Element to the Drop-Down
    laProxList.add(newOption);
    here i'm assuming that i'm sending a xml reponse of format something below.
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <drop-down>
       <option>
            <value>1</value>
            <text>label1</text>
       </option>
       <option>
            <value>2</value>
            <text>label2</text>
       </option>
       <option>
            <value>3</value>
            <text>label3</text>
       </option>
    </drop-down>and i'm trying to update both option's value and label which would be something like
    <select >
    <option value="1">label1</option>
    <option value="2">label2</option>
    <option value="3">label3</option>
    <option value="4">label4</option>
    </select>else where if you are interested in getting a format like the one below
    <select >
    <option>label1</option>
    <option>label2</option>
    <option>label3</option>
    <option>label4</option>
    </select> try the below snippet
    var response = xmlhttp.responseXML.getElementsByTagName("text");
    var length = response.length;
    var newOption
    for(var i =0 ; i < length;i++){
       newOption = this.document.createElement("OPTION");
       newOption.text = response.childNodes[0].nodeValue;
    // or newOption.text = response[i].firstChild.data
    laProxList.add(newOption);
    Another thing...
    I have tried to set the content type inside the JSP
    to
    response.setContentType("text/html");
    AND to
    response.setContentType("text/xml");
    but none of the above is getting me results......use of response.setContentType("text/xml"); is more appropriate here.. as you are outputting XML or a plain text here...
    make sure you set the reponse headers in the below fashoin while outputting the results....
    response.setContentType("text/xml");
    response.setHeader("Pragma", "no-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 1);
    response.setDateHeader("max-age", 0); and if you are serious about implementing AJAX i would advice you start learn basics of XmlHttpRequest Object and more about DOM parsing is being implemented using javascript.
    http://www.w3.org/TR/XMLHttpRequest/#xmlhttprequest0
    http://www.jibbering.com/2002/4/httprequest.html
    http://java.sun.com/developer/technicalArticles/J2EE/AJAX/
    http://developer.apple.com/internet/webcontent/xmlhttpreq.html
    http://www.javascriptkit.com/domref/documentproperties.shtml
    and then go about trying different means of achieving them using simpler and cool frameworks
    like DWR,dojo,Prototype,GWT,Jmaki,Back Base 4 Struts,Back Base 4 JSF....etc and
    others frameworks like Tomahawk,Ajax4Jsf,ADF Faces,ICE FACES and many others which work with JSF.
    Please Refer
    http://swik.net/Java+Ajax?popular
    http://getahead.org/blog/joe/2006/09/27/most_popular_java_ajax_frameworks.html
    Hope that might help :)
    and finally an advice before implementing anything specfic API which may be related to any technologies (JAVA,javascript,VB,C++...) always refer to API documentation first which always gives you an Idea of implementing it.
    Implementing bad examples posted by people(even me for that matter) directly doesn't make much sense as that would always lands you in trouble.
    and especially when it is more specific to XmlHttpRequest always make habit of refering
    specific Browser site to know more about why specific Object or its property it not working 4i
    IE 6+: http://msdn2.microsoft.com/en-us/library/ms535874.aspx
    MOZILLA: http://developer.mozilla.org/en/docs/XMLHttpRequest
    Safari: http://developer.apple.com/internet/webcontent/xmlhttpreq.html
    Opera 9+: http://www.opera.com/docs/specs/opera9/xhr/
    Hope there are no hard issues on this...
    REGARDS,
    RaHuL

  • How can I access JSP variables from a JavaScript function in a JSP page?

    Respected sir
    How can I access JSP variables from a JavaScript function in a JSP page?
    Thanx

    You may be get some help from the code below.
    <%
        String str="str";
    %>
    <script>
        function accessVar(){
           var varStr='<%=str%>';
           alert(varStr);// here will diplay 'str'
    </script>

  • Accessing JSP variables in Included Javascript

    Hey All,
    I want to hide my javascript to be viewed on the client browser.
    I know we can do that with the javascript include ,But i am using JSP variables in
    Included javascript.I can't access those variables any more.
    Does anybody know any workarround.
    Thanx
    Vijay

    Hi Vijay,
    I am also facing the same problem of hiding javascript in the client browser. My javascript variables are getting initialised on the fly using JSP. Since JSP is compiled on the server side, one can't compile .js file on the client side.
    What u can do is to divide your page into frames with
    <frameset rows="100%,0%">. Now put your form hidden fields or the .js file in frame 2 which is not visible to the user and then assign your jsp variables in the frame2 html/jsp page. Now access your variables from frame2 in frame1 using
    var i = parent.frames[1].document.forms[0].elements[0].value
    Assuming that there is 1 form and 1 hidden field in frame2 html/jsp page.
    I hope u get the logic rite....
    I had done it for application but problem is that our users are real MORONS and they keep doing ctrl+F5 which takes them to the Indexpage.
    If you get some other solution then please mail it to my email address
    [email protected]
    Regards
    Vimlesh

  • Is Mac to Mac faster than Mac to PC?

    Someone told me something which doesn't make sense to me, but I could be wrong. Is it true that a website made with my iMac is opened faster than, say Windows PC? This is what the person wrote to me. I don't know how to respond.
    She wrote:
    *'I know that but when you are working with the same exact equipment it goes faster too doesn't have to convert back and forth. That I know too.”*

    Website speed varies by web standards and web browsers used. See my FAQ* on what web standards are, and what web browsers exist:
    http://www.macmaps.com/browser.html
    Connection speed also varies widely unless you have a dedicated internet line. Not even ADSL is truly dedicated because your upstream is capped and connections on websites are as much a function of upstream as downstream traffic.
    - * Links to my pages may give me compensation.

  • Datasocket localhost faster than network name

    When I set my datasocket urls to dstp://localhost/var instead of dstp://machine_name/var the various connections are made MUCH faster. When using localhost, all variables seem to connect instantly, while if I use machine_name instead, it seems to make about 1 connection per second (I'm just watching the led indicator change to green) and so if I have a bunch of variables connecting, it can take quite awhile. I can use localhost on the server machine, however I need to be able to make fast connections on the client machine, and so I have to use machine_name. Is this some inherrent flaw in datasocket? Is there a workaround, or could I have a poor network driver?

    Greetings!
    "Localhost" does not require any name resolution...it is a "builtin" name in a windows environment. A "real" machine name requires name resolution,which always requires some time. You might try assigning your own machine as the name resolver. (YOu might need to poke around to see what machine on your network is really performing the name resolution.)
    Alternatively, use the IP address instead of the machine name.
    Just a few suggestions...
    Eric
    Eric P. Nichols
    P.O. Box 56235
    North Pole, AK 99705

  • Is DVD Studio Pro faster than iDVD?

    Sorry I'm double posting this but I didn't get my question in the Subject line. Is DVDSP faster than iDVD? If so, by how much? I'm on the endless quest for more speed.

    I have a feeling you're asking about the time to compress video, in which case it will depend on the settings you've chosen. As a rough guestimate I would say that iDVD will compress as fast as the faster possibilities in DVD Studio Pro (which is using Compressor behind the scenes). Using Compressor would allow you to more carefully get the best quality for a given amount of video, instead of iDVD's one hour or two hour approach.
    Usually though you would tend to compress the video before taking it into DVD Studio Pro, and you wouldn't need to compress it again before doing a build or burning a disc.
    If you meant is DVD Studio Pro faster to create a title, it varies depending on what the disc needs to do. The important thing is that there are things you just cannot do in iDVD, and if you need to do those you could use DVD Studio Pro to do them.

  • Is write mode faster than append mode?

    Hi All,
    I have to write some data after selecting from a table. I have to call six procedure to write data. Each of the procedure writes around 100-150MB data.
    If I generate six files in write mode it takes around 11 minutes. (using utl_file.fopen('/tmp','csv','w');)
    but if i generate 1 file (combining all) using (using utl_file.fopen('/tmp','csv','a');) It has passed 55 minutes an size of file is still around 500 MB and still growing.
    Can anyone explain why append is so slow comapred to write ? or there is any other reason .. note that we have lot of space on server.
    Regards,
    Amit

    What you've written does not compute.
    On my laptop I can write that much data far faster than what you've indicated you are seeing.
    What version number?
    How is the data being selected?
    How much time does the SELECT take without the WRITE?
    When I have large amounts of data to write my method of choice is to concatenate them into a CLOB and then write it out using DBMS_ADVISOR.CREATE_FILE
    http://www.morganslibrary.org/reference/dbms_advisor.html

  • Strange AIR performance; == faster than ===

    Hi.
    I have been hunting down some strange memory usage in one of our games, and tracked it down to numbers being compared to 0.0 in a loop.
    I have concentrated the observations down to a small profile snippet.
    Observations:
    1) I expected the first two profiles to take the same amount of time as everything is typed. But comparing a Number that is a natural is a LOT faster. (only true on desktop and android).
    Why is this, is the jitted versions storing Numbers that are natural (whole numbers) as integers, and thus causing a log of type conversion (and memory allocations)?
    2) I have been told (and experienced on iOS) that using the === operator is faster than == when a type coercion is possible, test 1+2 vs. 3+4 shows that this is not always the case on some of the platforms.
    Is this normal? have I messed up something when building my air apps? If this is reproducible, can somebody with better knowledge of the internals of the AIR runtime explain when it's better to use === over == (for performance).
    private var _unused:Number = 0;
    private function profileNumberCompare():void
       var t0:int = getTimer();
       _unused += profileEqEqEq(0.1);
       var t1:int = getTimer();
       _unused += profileEqEqEq(1.0);
       var t2:int = getTimer();
       _unused += profileEqEq(0.1);
       var t3:int = getTimer();
       _unused += profileEqEq(1.0);
       var t4:int = getTimer();
       trace(t1 - t0);
       trace(t2 - t1);
       trace(t3 - t2);
       trace(t4 - t3);
    private function profileEqEqEq(inc:Number):Number
       var x:Number = 0.0;
       var z:Number = 0.0;
       for(var i:int = 0; i < 10000000; i++)
       if(x === 0.0) z += 1;
       x += inc;
       return z;
    private function profileEqEq(inc:Number):Number
       var x:Number = 0.0;
       var z:Number = 0.0;
       for(var i:int = 0; i < 10000000; i++)
       if(x == 0.0) z += 1;
       x += inc;
       return z;
    Results:
    Desktop, adl  (E5530 @ 2.4GHz):
    1411
    171
    68
    71
    ipad4:
    52
    53
    53
    55
    nexus5:
    1230
    373
    148
    146

    Since your iPad is only 4 months old, I'd make an appointment at your local apple store and have them check it out.

Maybe you are looking for

  • [SOLVE] Dual Boot Windows and ArchLinux with Syslinux

    Ok, i installed ArchLinux on my laptop with Windows XP (syslinux) and I cannot find get Windows to boot or mount it. I have tried to do what i can to do this but cannot. I Installed XP first like a should and something i think might be needed to know

  • Dumb Q: problem with Find And Replace window in Flash 8

    Dear Flash Group, apologies if this is trivial, it's my first day using Flash. I downloaded a Flash project from http://www.flashorb.com/articles/benchmark_files/flash-benchmark.zip. This flash calls into a web service at localhost:8080. I used the '

  • Standard Report for Vendor Master

    Hi all, Is there any standard report in SAP that shows all fields in vendor master data for a list of vendors? Please respond. Best Regards, AI.

  • LaserJet 5100 printing issue

    I have a LaserJet 5100 - purchased in 2005 - worked great until I just bought a new HP Pavilion computer.  It prints normal text fine but having issues printing 11x17 pdf drawings.  I have tried loading updated drivers from HP site, called HP and tal

  • AP test scenario

    Hi Friends Can anyone please send me the testing document for Accounts payable......to [email protected] Its urgent please.... Thanks