Xmlhttp request

i am looking at a xmthttprequest tutorial
it says that Similar functionality is proposed by the W3C DOM Level 3 Load and Save specification standard, which hasn't been implemented yet by web browsers.
does anyone know what this is and if it has been implemented yet

well then the only thing you can do is run the servlet through a debugger, for example using Eclipse. Step through each line and see the status of the variables, trying to find the spot where you are not getting what you are expecting.

Similar Messages

  • Xmlhttp request error

    We have a Flex applicaiton that is working fine using the xmlhttp request object for background communication.  There is one user who consitently gets a xmlhttp request error (in IE6).  The user can go directly to the url that it is trying to access, so there are no security issues.  We tried disabling all the add-ons to the browser (except the flash active x control).  We checked all browser security settings and other options and didn't find any differences that would cause an error.
    Has anyone seen this type of behavior?  Any suggestions on troubleshooting this issue?
    Thanks,
    Cindy

    i have the same thing happening. I have a person with two laptops both using firefox, on one laptop the swf functions as desired on the other there is a security error ( not a sandbox error - just a "security error") It is not a cross domain issue - which seems to be everyone's favorite suggestion, since the swf resides on the same server/domain its calling
    here is a similar issue http://bugs.adobe.com/jira/browse/FP-2264
    in my case 10.0.12.36 version consistently produces the desired result where as 10.0 r32 has issues.

  • How to use xmlhttp

    hi everybody
    My problem is that i have one dropdown list on selection of one item
    i have to call two different ajax pages for showing data from db
    how should i use xmlhttp request twice in one call
    anybody please gove me suggessions

    I have to build a custom application that does a http
    post of an XML file towards a ASP file runnning on
    the suppliers server. This application is scheduled
    to run automatically every week.Okay.
    I want to build this application using Java.Okay.
    Suppliers are using XMLHTTP on their side. So what? If they all jumped off a cliff, would you jump off too?
    Can you give me any ideas on how to impelement it? I
    have to use XMLHTTP object, but I just know that I
    can use it with in the JavaScript. Is there any way
    that I can get handle to XMLHTTP object in the Java
    program through which I can post my fileWho told you that you have to use XMLHTTP? If your requirement is "http post of an XML file" then it's pretty simple. Read this part of the networking tutorial:
    http://java.sun.com/docs/books/tutorial/networking/urls/index.html
    You may find that this works okay. But if you run into difficulties, like you have to authenticate or accept cookies or something like that, then try using Jakarta Commons HttpClient to deal with that stuff:
    http://jakarta.apache.org/commons/httpclient/

  • FileExists not working correctly.

    Why will this redirect work perfectly :-
    Response.Redirect("http://webservername/SafetyRecordsOffice/AsbestosPhotos/" & cStr(Request.Form("photo_ref")) &".jpg")
    and this won't :-
    Set photoExists = CreateObject("Scripting.FileSystemObject")
       If photoExists.FileExists("http://webservername/SafetyRecordsOffice/AsbestosPhotos/" & cStr(Request.Form("photo_ref")) &".jpg") Then
             Response.Redirect("http://webservername/SafetyRecordsOffice/AsbestosPhotos/" & cStr(Request.Form("photo_ref")) &".jpg")
        End If
      set photoExists=nothing
    Even if I store the url to a variable it still works without the CreateObject, am I missing something?
    Thanks in advance
    Joan.

    FileExists is an FSO method, yet you are using a url as a parameter. You need to use the filesystem path.
    If you'd rather use a url, then use something like this instead:
    http://stackoverflow.com/questions/1542790/msxml2-xmlhttp-request-to-validate-entered-url- in-asp-classic

  • Call struts action from javascript?

    Hi all
    I'm having problem already discussed here quite a lot, but I have idea to solve it different way. And need to know is it possible or I'm doing mission impossible here :(
    I have JSP with 2 drop down lilsts, where the second is populated according to selected value from first - that's basically my problem.
    Is it possible to somehow only call my struts action which will return all needed values using javascript and onchange event handler?
    I dont have any experience with javascript, and I'm trying to avoid it as much as possible at the moment.
    Thanks in advance

    well as far your requirement is concern if at all you are planning to implement AJAX try to use the below link which might be of some help...
    http://www.it-eye.nl/weblog/2005/12/13/ajax-in-struts-implementing-dependend-select-boxes/
    However,I somehow feel there are few loopholes in the author's approach...
    i advice to use XmlHttpRequest.reponseXML property there.
    However, i've mentioned a sample code snippet for you reference.
    XML Response Pattern :
    ======================
    <? xml version="1.1" ?>
    <dropdown>
    <option>
    <val>CUSTOMIZED_VALUE</val>
    <text>CUSTOMIZED_VALUE</text>
    </option>
    </dropdown>Sample.jsp:
    ===========
    <%@page language="java" %>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Automatic Drop-Down Updation</title>
         <script language="javascript">
          // Global Variable for XmlHttp Request Object  
          var xmlhttp
          // Timer Variables
          var c = 0
          var t
           /* A function which calls a servlet  named AjaxServlet to get XmlData using XmlHttpObject */    
            function refreshCombo(txt){
                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){
                  // Setting the Action url to get XmlData
                   url = "dropdown.do?count="+txt;
                   // Course of Action That Should be Made if their is a change in XmlHttpRequest Object ReadyState NOTE : it is 4 when it has got request from CGI
                   xmlhttp.onreadystatechange = getResponseAction;
                   // 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.")
          /* Used for verifing right ReadyState & Status of XmlHttpRequest Object returns true if it is verified */
          function verifyReadyState(obj){
             // As Said above if XmlHttp.ReadyState == 4 then the Page Has got Response from WebServer
              if(obj.readyState == 4){
               // Similarly if XmlHttp.status == 200 it means that we have got a Valid response from the WebServer
                if(obj.status == 200){               
                    return true
                 else{
                    alert("Problem retrieving XML data")
          /* Action that has to take place after getting reponse */
          function getResponseAction(){
              // Verifying State & Status
              if(verifyReadyState(xmlhttp) == true){
                  // Building a DOM parser from Response Object
                  var response = xmlhttp.responseXML.documentElement
                  // Deleting all the Present Elements in the Drop-Down Box
                  drRemove()      
                  // Checking for the Root Node Tag
                  var x = response.getElementsByTagName("option")
                  var val
                  var tex
                  var optn
                  for(var i = 0;i < x.length; i++){
                     optn = document.createElement("OPTION")
                     var er
                     // Checking for the tag which holds the value of the Drop-Down combo element
                     val = x.getElementsByTagName("val")
    try{
    // Assigning the value to a Drop-Down Set Element
    optn.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
    optn.text = tex[0].firstChild.data
    } catch(er){
    // Adding the Set Element to the Drop-Down
    document.SampleForm.SampleCombo.options.add(optn)
    /* Function removes all the elements in the Drop-Down */
    function drRemove(){
    var x = document.SampleForm.SampleCombo
    for(var i = document.SampleForm.SampleCombo.length - 1 ; i >= 0 ; i--){                     
    x.remove(i)
    </script>
    </head>
    <body onload="syncCount()">
    <pre> <h1>Refresh Drop-Down <div id='txt'> </div> </h1></pre>
    <form name="SampleForm">
    <!-- Drop Down which has country list -->
    <select name="x" onchange="refreshCombo(this.value)">
                   <option value="1">United States</option>
                   <option value="2">United Kingdom</option>
                   <option value="3">United Arab Emriates</option>
    </select>
    <!-- Drop Down which is dependent on Country Drop down get list of states -->
    <select name="SampleCombo">
    <option value="-1">Pick One</option>
    </select>
    </form>
    </body>
    </html>
    struts-config.xml:
    ==================
    <action-mappings>
    <action path="/dropdown" type="com.controlleraction.AjaxActionClass">
    <forward name="error" path="/error.jsp"/>
    </action>
    </action-mappings>AjaxActionClass.java:
    =====================
    package com.controlleraction;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public class AjaxActionClass extends DispatchAction {
      public ActionForward execute( ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
        String req = new String("");
        try{
           req = request.getParameter("count");
        } catch(Exception exp){
       if(!req.equals("")){
           response.setContentType("text/xml");        
           response.setHeader("Pragma","no-cache");
           response.setHeader("Cache-Control","no-cache,post-check=0,pre-check=0");
           PrintWriter out = response.getWriter();
           /*a sample bean where we trying to call a service from Model*/
           com.Biz.XmlBean xml = new XmlBean();
           String buffer = xml.getXmlData(req);
           if(xml.close() == true && buffer.equals("") == false)
             out.write(buffer);     
           return(null);
      } else {
         return new ActionForward("error");
    }XmlBean.java:
    =============
    * XmlBean.java
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    * @author RaHuL
    public class XmlBean {
        private Connection con = null;
        private PreparedStatement pstmt = null;
        private ResultSet rs = null;
        // Setting CLASSURL path to TYPE I Driver
        private String CLASSURL = "sun.jdbc.odbc.JdbcOdbcDriver";
        /* Specifing CONNECTION PATH to a DSN named TestDsn
         * Please Make Sure you create a DSN Named TestDsn to your database which holds EMP table
        private String CONNECTIONURL = "jdbc:odbc:TestDsn";
        boolean IS_ESTABLISHED = false;
        /** Creates a new instance of XmlBean and also establishes DB Connections */
        public XmlBean() {
            try{
                Class.forName(CLASSURL);
                con = DriverManager.getConnection(CONNECTIONURL,"admin","");
                IS_ESTABLISHED = true;
            } catch(SQLException sqe){
                sqe.printStackTrace();
            } catch(Exception exp){
                exp.printStackTrace();
        /* Generates XmlData For the Business Logic Specified */
        public String getXmlData(String req){
            String XmlBuffer = new String("");
            if(IS_ESTABLISHED == true){
                try{
                    pstmt = con.prepareStatement("SELECT stateid,statename FROM STATE_TABLE where countryid = ?");
                    pstmt.setString(1,req);
                    rs = pstmt.executeQuery();
                    if(rs != null){
                        XmlBuffer = XmlBuffer + "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
                        XmlBuffer = XmlBuffer + "<!--  Edited by Rahul Sharma -->";
                        // Root Node
                        XmlBuffer = XmlBuffer + "<dropdown>";
                        while(rs.next()){
                            String value = rs.getString(1);
                            String text = rs.getString(2);
                            // Sub-root Node
                            XmlBuffer = XmlBuffer + "<option>";
                            // node which holds value of drop-down combo
                            XmlBuffer = XmlBuffer + "<val>"+value+"</val>";
                            // node which holds text for drop-down combo
                            XmlBuffer = XmlBuffer + "<text>"+text+"</text>";
                            XmlBuffer = XmlBuffer + "</option>";
                        XmlBuffer = XmlBuffer + "</dropdown>";
                }catch(SQLException sqe){
                    sqe.printStackTrace();
                } catch(Exception exp){
                    exp.printStackTrace();
            return(XmlBuffer);
        /* Closes the DB Connection Conmpletely */
        public  boolean close(){
            if(IS_ESTABLISHED == true){
                try{
                    pstmt.close();
                    con.close();
                    return(true);
                } catch(SQLException sqe){
                    sqe.printStackTrace();
                } catch(Exception exp){
                    exp.printStackTrace();
            return(false);
    NOTE: I understand i'm not completely coded things as per proper coding standards.please execuse me for that as this example was just given to enable user to learn how XmlHttpRquest,reponseXML
    can be used for better purposes instead of devising manual parsing.
    where i've used XmlHttpResponse pattern to be in XML. you may make use of other practices like JSON & so on depending on your requirement..
    and and if you are more instrested in integrating Struts with AJAX using few frameworks & customized tag based support please go though the below link.
    http://struts.sourceforge.net/ajaxtags/index.html
    Hope that might help :)
    REGARDS,
    RaHuL

  • CFID & CFTOKEN added to URL by CF

    CF automatically appends CFID & CFTOKEN to the URL when
    using <div <span with id = a variable.
    They are not appended when a constant is used.
    I do not want these to be displayed unless I append them
    myself.
    Is this a CF bug, or can I change my code somehow?
    I display a variable number of rows, so using a constant is
    not a solution.
    And, I use client and session variables throughout my app.
    Please help me. Thanks a bunch.
    <cfapplication name="myApp" sessiontimeout="20"
    sessionmanagement="Yes"
    setclientcookies="Yes" clientmanagement="Yes">
    This is BAD ...
    URL with the following code:
    abc/action.cfm?CFID=1851&CFTOKEN=76141078
    <div id="#style#">
    <span id="#style#"
    onclick="location.href='abc/action.cfm'">
    <table><tr><td>info</td></tr></table>
    </span>
    </div>
    This is GOOD ...
    URL with the following code: abc/action.cfm
    <div id="1001">
    <span id="1001"
    onclick="location.href='abc/action.cfm'">
    <table><tr><td>info</td></tr></table>
    </span>
    </div>

    Greetings Steve and other URLSessionFormat fans.
    The remote file of a XMLHttp request (Spry) among other
    things is trying to set two sessions.variables.
    I have been told that if the remote file doesn't know the
    session CFID & CFTOKEN the new session variables wil not be
    recognized, and to avoid that I should use URLSessionFormat.
    Now, my original Spry request look like this:
    var request_URL
    ="/petitions/client/remote/authenticate.cfm?username="+uName+"&password="+uPass;
    Spry.Utils.loadURL("GET", request_URL, false, authBack);
    which returns values as expected but does not set the session
    variables, so I combine it with URLSessionFormat, like this:
    var request_URL =
    '#URLSessionFormat("/petitions/client/remote/authenticate.cfm?username='+uName+'&password ='+uPass+'")#';
    The variable "request_URL" will render:
    "/petitions/client/remote/authenticate.cfm;jsessionid=7e301d2f98475b4d5f10?username="+uNa me+"&password="+uPass&CFID=300&CFTOKEN=11985066"
    which causes Spry to catch an exception while loading the url
    and the request fails altogether.
    Please note the " ; " semicolumn sign between the filename
    "authenticate.cfm" and "jsessionid=" which is not like
    CF7.1 example
    "myactionpage.cfm?jsessionid=xxxx;cfid=xxxx&cftoken=xxxxxxxx"
    found in livedocs.
    Is either my code, macromedia example, or both wrong?
    Or maybe it needs some tweaking and fixing to replace the
    semicolumn and put the question mark in the right place?
    Pulling quite a few hair here. Thanks for helping.

  • CFID & CFTOKEN

    Hi there,
    I’m creating a cart & payment system using
    Coldfusion MX 6.1. I have two application servers which are load
    balanced. So I cannot use sessions to track user logins and other
    variables because if the load balancer diverts a request to the
    other server where the session does not exist then the person will
    be logged out.
    So I’m forced to use client variables. I’m
    against using cookies for better security. So the option left for
    me is store client variables in database. So I’m using the
    help of CFID & CFTOKEN to track logins and store client
    variables in database.
    Now the problem is I’m using URLSessionFormat function
    to pass CFID & CFTOKEN to all pages after login. I have
    following problems:
    1) If I copy the URL, which contains the CFID & CFTOKEN,
    close the browser and paste it in another browser window – it
    opens up the page with out any authentication.
    2) If I copy and paste the same URL on a browser window in
    another PC, it works.
    These two scenarios fail my security to the application. Can
    anyone please advice a way to kill the CFID & CFTOKEN on
    browser close or some mechanism to stop this occurring?
    Any help is greatly appreciated.
    Many thanks / Manu.

    Greetings Steve and other URLSessionFormat fans.
    The remote file of a XMLHttp request (Spry) among other
    things is trying to set two sessions.variables.
    I have been told that if the remote file doesn't know the
    session CFID & CFTOKEN the new session variables wil not be
    recognized, and to avoid that I should use URLSessionFormat.
    Now, my original Spry request look like this:
    var request_URL
    ="/petitions/client/remote/authenticate.cfm?username="+uName+"&password="+uPass;
    Spry.Utils.loadURL("GET", request_URL, false, authBack);
    which returns values as expected but does not set the session
    variables, so I combine it with URLSessionFormat, like this:
    var request_URL =
    '#URLSessionFormat("/petitions/client/remote/authenticate.cfm?username='+uName+'&password ='+uPass+'")#';
    The variable "request_URL" will render:
    "/petitions/client/remote/authenticate.cfm;jsessionid=7e301d2f98475b4d5f10?username="+uNa me+"&password="+uPass&CFID=300&CFTOKEN=11985066"
    which causes Spry to catch an exception while loading the url
    and the request fails altogether.
    Please note the " ; " semicolumn sign between the filename
    "authenticate.cfm" and "jsessionid=" which is not like
    CF7.1 example
    "myactionpage.cfm?jsessionid=xxxx;cfid=xxxx&cftoken=xxxxxxxx"
    found in livedocs.
    Is either my code, macromedia example, or both wrong?
    Or maybe it needs some tweaking and fixing to replace the
    semicolumn and put the question mark in the right place?
    Pulling quite a few hair here. Thanks for helping.

  • Extra white-space after page proccess

    I am trying to suppress white-spaces after the page is
    processed.
    Usually it doesn't bother me, but it does bother javascript.
    Explanation:
    1. I am sending an xmlhttp request to coldfusion to process.
    2. Coldfusion runs a stored procedure on an oracle database
    that returns the results as XML.
    3. Coldfusion returns the XML back to the client:
    <cfoutput>#XmlParse(ajaxXML)#</cfoutput>.
    4. The client (Javascript) runs the function that handle the
    data and returns an error because: "
    xml declaration not at start of external entity".
    I have tried using cfsetting with the attribute:
    enablecfoutputonly="yes", but still the result is the same.
    Any idea or lead in the right direction would be greatly
    appreciated.

    The XML that the DB returns, looks like this:
    <?xml version="1.0"?>
    <rowset>
    <row>
    <column_name>value</column_name>
    <column_name>value</column_name>
    </row>
    </rowset>
    After playing with code for a while now, I believe that the
    problem is not with the returned XML.
    The page that runs the SP is the page that call the SP. What
    means that the white-spaces are the code that the Coldfusion engine
    has already processed (although, the condition that checks whether
    the form variable that Ajax request, exist. Is the first thing on
    the page). to my understanding, the returned XML should be at the
    top of the page.
    I hope that I was clear enough.
    Thank you.

  • Could any one give me direction towards creating asset with REST/javascript

    could any one give me direction towards creating asset with REST/javascript?

    There is a sample bundled with webcenter sites at Misc/articles. You have to implement the proxy controller which serve as proxy for xmlhttp request.
    The proxy will redirect the request actual REST resource in the target server

  • Using httprequest object

    I'm a struts frame work developer and I'm trying to populate combobox using httprequest object. The code seems working( I debugged it) don't populate the combo. My code is as follows.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/salIncrement.tld" prefix="salIncrement" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/WEB-INF/emplContext.tld" prefix="emplContext" %>
    <html:html>
    <HEAD>
    <%@ page
    language="java" pageEncoding="utf-8"
    contentType="text/html; charset=utf-8"
    errorPage="error.jsp"
    isErrorPage="false"
    %>
    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
    <META name="GENERATOR" content="IBM WebSphere Studio">
    <META http-equiv="Content-Style-Type" content="text/css">
    <LINK href="theme/Master.css" rel="stylesheet" type="text/css">
    <TITLE>salaryIncrement.jsp</TITLE>
    <script language="JavaScript">
    function up(cd){
    var code=cd.value;
         var request = null;
         request =new ActiveXObject("Msxml2.XMLHTTP");
    request.open("GET","emplSalaryIncrement.jsp?structureCode="+code);          
         request.send(null);
    </script>
    </HEAD>
    <BODY>
    <html:javascript formName="salaryIncrementForm"/>
    <html:form action="/newSalaryIncrement.do" onsubmit=" return validateSalaryIncrementForm(this);">
    <TABLE width="100%">
         <TR>
         <TD class="formheader">
              <bean:message key="SalaryIncrement.Title"/>
         </TD>
         </TR>
    </TABLE>
    <TABLE>
    <TR>     
         <TH><bean:message key="SalaryIncrement.SalaryStructure" /> </TH>
         <TD width="50%">
    <select size='1' name='salaryStructure' style='width: 99%' style='font-size: 8pt;font-family: visual GeezUnicode'      onchange='up(this)'>
         <option value="001">one </option>
         <option value="002">two</option>
    </select>
              </TD>
    </TR>
    <TR>     
         <TH><bean:message key="SalaryIncrement.Grade" /> </TH>
         <TD>
         <%
         String salaryStructure="";
         salaryStructure=request.getParameter("structureCode");
              String language=locale.getLanguage();
              int count=0,i=0;
              HashMap param=new HashMap();
         if(!salaryStructure.equals(null)&&!salaryStructure.equals("")){
              param.put("Code",salaryStructure);
              param.put("locale",language);
              ResultSet rs= DataSourceFactory.instance().getDataSource().select("getServiceType",param);%>
              <select size='1' name='jobGrade' style='width: 99%' style='font-size: 8pt;font-family: visual Geez Unicode'>     
              <%while(rs.next()){%>
    <option value="<%=rs.getString("Code"));%>"><%=rs.getString("Description"));%> </option>
              <% }%>
         <%}else{%>
         <select size='1' name='jobGrade' style='width: 99%' style='font-size: 8pt;font-family: visual Geez Unicode'>     
    <option value=""></option>
         <%}%>
         </select>
    </TD>
    </TR>
    </TABLE>
    </html:form>
    </BODY>
    </html:html>

    You're in the wrong forum, try: http://forum.java.sun.com/forum.jspa?forumID=45

  • Safari global page cookies

    I've recently been porting a Chrome extension to Safari, and encountered this kind of error (bug, feature, etc.)
    So, in global page i have a XMLHTTP request to a secure page which is available only after you login.
    Example:
    1. I simply login using browser - as usually you do on facebook or other secure pages
    2. In global page, I load a login-only-availeble xmlhttp - and it says i'm not logged in
    it seems that global page somewhat has it's own cookies, so a secure page thinks i'm new
    ps: in Chrome i can load that page and it thinks i'm acting on behalf of logged in user

    I deleted the cookies plist and everything is fine, thanks for the help

  • Working of ComboBox in JSP

    I am new to jsp programming. I have no idea how to navigate if there is two dropdownlist. Here second one depends on the first one then should i have to design two pages with sam dessign?
    I have checked the url
    http://forum.java.sun.com/editwatches!default.jspa
    thsi page contains two comboboxes. I have selected java essentials from first combo. Then it got redirected to another page.
    with the url
    http://forum.java.sun.com/editwatches!default.jspa?filterCat=5
    When I checked the view source of http://forum.java.sun.com/editwatches!default.jspa
    I have seen something like this...
    <select name="filterForum"
    onchange="location.href='editwatches!default.jspa?filterForum='+this.options[this.selectedIndex].value+'&filterCat='+this.form.filterCat.options[this.form.filterCat.selectedIndex].value;">
    In the above code what do they mean by location?
    Please reply me
    Thanks in advance

    Hi,
    Well if you are looking for Dependent Dropdown problem...
    There are many solutions in order acheive this...
    checkout some of those...
    1).Save the present of the Form in a Bean with the scope of session and onChange of the first Combo box redirect it to a Controller(Servlet) Query the Database and save the results in the FormBean which we saved in the scope session and then redirect the formBean to the same JSP again...and now repopulate the second combo with new obtained results from the database and repopulate the rest of the form according to present FormBean state from the session.
    Here is a Typical example for you
    Assuming that a Servlet had already preloaded the first drop-down values from the database in a FormBean
    FormBean.java
    =============
    public class FormBean{
    private String firstDDValue = new String("");
    private ArrayList firstDDOptions = new ArrayList();
    private String secondDDValue = new String();
    private ArrayList secondDDOptions = new ArrayList();
    // Setters & getters for all the bean properties.
    }Form.jsp:
    =========
    <jsp:useBean id="formBean" class="com.formbeans.FormBean" scope="session"/>
    <%
      ArrayList fristDD = formBean.getFirstDDOptions();
      ArrayList secondDD = formBean.getSecondDDOptions();
      String firstDDValue = formBean.getFirstDDValue();
      String secondDDValue = formBean.getSecondDDValue();
      int FDSIZE = fristDD.size();
      int SDSIZE = secondDD.size();
    %>
    <form name="formBean">
    First DropDown:
    <select name="firstDropDown" onChange="if(this.value != '-1')window.location.href='ControlerServlet?firstDropDown='+escape(this.value);" >
    <option value="-1">Pick One</option>
    <%for(int i = 0;i < FDSIZE ; i++){
        String value = ((String[])firstDDOptions.get(i))[0];
        String text = ((String[])firstDDOptions.get(i))[1];
    %>
      <%if(value.equals(firstDDValue){)%>
       <option value="<%=value%>" selected="selected"><%=text%></option>
      <%}else{%>
       <option value="<%=value%>"><%=text%></option>
      <%}%>
    <%}%>
    </select>
    <BR/>
    <BR/>
    Second DropDown:
    <select name="secondDropDown">
    <option value="-1">Pick One</option>
    <%for(int i = 0;i < FDSIZE ; i++){
        String value = ((String[])secondDDOptions.get(i))[0];
        String text = ((String[])secondDDOptions.get(i))[1];
    %>
      <%if(value.equals(secondDDValue){)%>
       <option value="<%=value%>" selected="selected"><%=text%></option>
      <%}else{%>
       <option value="<%=value%>"><%=text%></option>
      <%}%>
    <%}%>
    </select>
    <BR/>
    <BR/>
    </form> NOTE: It would be a better practise if you can make use of JSTL tags to render the page in to make your View Page look more cleaner
    ControlerServlet.java
    =====================
    public doGet(request,response){
    String firstDropDown = request.getParameter("firstDropDown");
    HttpSession session = request.getSession();
    FormBean fb = (FormBean) session.getAttribute("formBean");
    fb.setFirstDDValue(firstDropDown); 
    fb.setSecondDDOptions(DAODelegate.getSecondDropDownData(firstDropDown));
    session.setAttribute(""formBean",fb);
    response.sendRedirect("/Form.jsp");
    }2).Make use of a Hidden IFrame by using which you reload the page and then Reload a Page after getting values from the database update the parent frame combo accordingly.
    3).Take help of AJAX call a Controller get the Response in XML/JSON and parse it and then update the second combo by the XML/JSON response.
    checkout an example by you can achieve this.
    index.jsp:
    =======
    <%@page language="java" %>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Automatic Dependent Drop-Down Updation</title>
         <script language="javascript">
          // Global Variable for XmlHttp Request Object  
          var xmlhttp
          // Timer Variables
          var c = 0
          var t
           /* A function which calls a servlet  named AjaxServlet to get XmlData using XmlHttpObject */    
            function refreshCombo(txt){
                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){
                  // Setting the Servlet url to get XmlData
                   url = "AjaxServlet?req="+txt;
                   // Course of Action That Should be Made if their is a change in XmlHttpRequest Object ReadyState NOTE : it is 4 when it has got request from CGI
                   xmlhttp.onreadystatechange = getResponseAction;
                   // 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.")
          /* Used for verifing right ReadyState & Status of XmlHttpRequest Object returns true if it is verified */
          function verifyReadyState(obj){
             // As Said above if XmlHttp.ReadyState == 4 then the Page Has got Response from WebServer
              if(obj.readyState == 4){
               // Similarly if XmlHttp.status == 200 it means that we have got a Valid response from the WebServer
                if(obj.status == 200){               
                    return true
                 else{
                    alert("Problem retrieving XML data")
          /* Action that has to take place after getting reponse */
          function getResponseAction(){
              // Verifying State & Status
              if(verifyReadyState(xmlhttp) == true){
                  // Building a DOM parser from Response Object
                  var response = xmlhttp.responseXML.documentElement
                  // Deleting all the Present Elements in the Drop-Down Box
                  drRemove()      
                  // Checking for the Root Node Tag
                  var x = response.getElementsByTagName("option")
                  var val
                  var tex
                  var optn
                  for(var i = 0;i < x.length; i++){
                     optn = document.createElement("OPTION")
                     var er
                     // Checking for the tag which holds the value of the Drop-Down combo element
                     val = x.getElementsByTagName("val")
    try{
    // Assigning the value to a Drop-Down Set Element
    optn.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
    optn.text = tex[0].firstChild.data
    } catch(er){
    // Adding the Set Element to the Drop-Down
    document.SampleForm.state.options.add(optn)
    /* Function removes all the elements in the Drop-Down */
    function drRemove(){
    document.SampleForm.state.options.length = 0;
    </script>
    </head>
    <body>
    <pre> <h1>Refresh Drop-Down <div id='txt'> </div> </h1></pre>
    <form name="SampleForm">
    <table align="center">
    <tr>
    <td>Country:</td>
    <td>
    <select name="country" onchange="refreshCombo(this.value)">
    <option value="india">INDIA</option>
    <option value="US">United States</option>
    <option value="UK">United Kingdom</option>
    <option value="Saudi">Saudi</option>
    </select>
    </td>
    </tr>
    <tr>
    <td>State:</td>
    <td>
    <select name="state">
    <option value="-1">Pick One</option>
    </select>
    </td>
    </tr>
    </form>
    </body>
    </html>
    AjaxServlet.java:
    =============
    * AjaxServlet.java
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    * @author RaHuL
    * @version
    public class AjaxServlet extends HttpServlet {
        /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
         * @param request servlet request
         * @param response servlet response
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            // Sets the content type made to xml specific
            response.setContentType("text/xml");
            response.setHeader("pragma","no-cache");
            response.setHeader("Cache-Control","no-cache");
            response.setHeader("Cache-Control","no-store");
           //Initializing PrintWriter
            PrintWriter out = response.getWriter();
            String req = request.getParameter("req");
            // Creating an instance of XmlBean Which generates XmlData From Business Logic specified
            XmlBean xml = new XmlBean(req);
            // Method to Generate XMLDATA
            String buffer = xml.getXmlData();
            // If Close of DB connections are succefull then write the content to the printstream
            if(xml.close() == true)
                out.write(buffer);   
            out.flush();                 
            out.close();
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            // Calls a Method called processRequest Which Processes the request which was made by the Browser Page
            processRequest(request, response);
    }XmlBean.java:
    ===========
    * XmlBean.java
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    * @author RaHuL
    public class XmlBean {
        private Connection con = null;
        private PreparedStatement pstmt = null;
        private ResultSet rs = null;
        private String req;
        // Setting CLASSURL path to TYPE I Driver
        private String CLASSURL = "sun.jdbc.odbc.JdbcOdbcDriver";
        /* Specifing CONNECTION PATH to a DSN named TestDsn
         * Please Make Sure you create a DSN Named TestDsn to your database which holds EMP table
        private String CONNECTIONURL = "jdbc:odbc:TestDsn";
        boolean IS_ESTABLISHED = false;
        /** Creates a new instance of XmlBean and also establishes DB Connections */
        public XmlBean(String req) {
            try{
                this.req = req;
                Class.forName(CLASSURL);
                con = DriverManager.getConnection(CONNECTIONURL,"admin","");
                IS_ESTABLISHED = true;
            } catch(SQLException sqe){
                sqe.printStackTrace();
            } catch(Exception exp){
                exp.printStackTrace();
        /* Generates XmlData For the Business Logic Specified */
        public String getXmlData(){
            String XmlBuffer = "";
            if(IS_ESTABLISHED == true){
                try{
                    pstmt = con.prepareStatement("SELECT stateid,statename FROM EMP where countryid=' "+req+" ' " );
                    rs = pstmt.executeQuery();
                    if(rs != null){
                        XmlBuffer = XmlBuffer + "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
                        XmlBuffer = XmlBuffer + "<!--  Edited by Rahul Sharma -->";
                        // Root Node
                        XmlBuffer = XmlBuffer + "<dropdown>";
                        while(rs.next()){
                            String value = rs.getString(1);
                            String text = rs.getString(2);
                            // Sub-root Node
                            XmlBuffer = XmlBuffer + "<option>";
                            // node which holds value of drop-down combo
                            XmlBuffer = XmlBuffer + "<val>"+value+"</val>";
                            // node which holds text for drop-down combo
                            XmlBuffer = XmlBuffer + "<text>"+text+"</text>";
                            XmlBuffer = XmlBuffer + "</option>";
                        XmlBuffer = XmlBuffer + "</dropdown>";
                }catch(SQLException sqe){
                    sqe.printStackTrace();
                } catch(Exception exp){
                    exp.printStackTrace();
            return(XmlBuffer);
        /* Closes the DB Connection Conmpletely */
        public  boolean close(){
            if(IS_ESTABLISHED == true){
                try{
                    pstmt.close();
                    con.close();
                    return(true);
                } catch(SQLException sqe){
                    sqe.printStackTrace();
                } catch(Exception exp){
                    exp.printStackTrace();
            return(false);
    }Sample XML Reponse generated:
    <?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>
    <!--  Edited by Rahul Sharma -->
    <dropdown>
    <option>
    <val>DEL</val>
    <val>New Delhi</val>
    </option>
    <option>
    <val>HAR</val>
    <val>HARYANA</val>
    </option>
    </dropdown>for further reference you may use the below articles
    http://www.it-eye.nl/weblog/2005/12/13/ajax-in-struts-implementing-dependend-select-boxes/
    http://www.it-eye.nl/weblog/2006/04/04/implementing-dependent-select-boxes-in-jsf/
    Hope this might help,if that does do not forget to assign/distribute Duke Stars which you have promised :)
    REGARDS,
    RaHuL

  • [java]retreiving xml from SAP netweaver service

    hello guys,
    we have developped service on the netweaver platforme  , and while we were trying to call the services (xml)
    through xmlhttp request , it didn't work , cuz the xmlhttp request object isn't cross-domaine.
    so  i am trying to go through proxy servlet  wich will delegate the request to the external sap url, get the xml
    then return it back to the client .
    URLConnection urlcon = real.openConnection();
                    urlcon.setConnectTimeout(1000000);
                    InputStream ins =urlcon.getInputStream();
                     in = new BufferedReader(
                      new InputStreamReader(ins));
                    String inputLine;
                    while ((inputLine = in.readLine()) != null)
                           out.println(inputLine);
                   }  catch(java.net.MalformedURLException ex){ System.out.println(ex.getMessage()); }
                      catch(IOException ex){System.out.println(ex.getMessage());}
    it works with every website except the sapportal service url .
    i don't if sap portal have some specific practises , or shall we just treat it as an ordinary xml page .
    best regards

    here is the error the server returns  "401 unauthorized"
    i started wondering .. what's so special about an sap portal and a normal page ?
    cuz every other website work , except the one , it work right away in  the web browser , but not in java code
    eventhough the proxy is the same .
    i('m very new to sap portal developement , very confused in the time being ... whether i should use the sap portal connector  middleware , or just a normal urlconnection.
    plz help

  • XML retrieval query

    Hi folks,
    I'm still developing my system monitoring application using
    spry, but have noticed a curious issues when monitoring the
    xmlhttprequest's through firebug.
    The first time the dynamic xml files are called, one
    httprequest is run for each ds entry, however, on the second and
    later calls, it seems to generate 2 or 3 httprequests per ds entry.
    I've included the code below in case i've missed something
    completely obvious.
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml"
    xmlns:spry="
    http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Server Perfomance Monitoring
    System</title>
    <script src="SpryAssets/SpryAccordion.js"
    type="text/javascript"></script>
    <script src="SpryAssets/xpath.js"
    type="text/javascript"></script>
    <script src="SpryAssets/SpryData.js"
    type="text/javascript"></script>
    <link href="SpryAssets/SpryAccordion.css" rel="stylesheet"
    type="text/css" />
    <script type="text/javascript">
    <!--
    var ds1 = new Spry.Data.XMLDataSet("wmitest.asp",
    "/root/server", { useCache: false, loadInterval: 60000 });
    var ds2 = new Spry.Data.XMLDataSet("memory.asp",
    "/root/server", { useCache: false, loadInterval: 60000 });
    var ds3 = new Spry.Data.XMLDataSet("cpu.asp", "/root/server",
    { useCache: false, loadInterval: 60000 });
    //-->
    </script>
    <style>
    body {
    color:#666666;
    font-family:Arial,Helvetica,sans-serif;
    font-size:small;
    img {
    border-top-style: none;
    border-right-style: none;
    border-bottom-style: none;
    border-left-style: none;
    </style>
    </head>
    <body>
    <p> </p>
    <div id="Accordion1" class="Accordion" tabindex="0">
    <div class="AccordionPanel">
    <div class="AccordionPanelTab">IIS Statistics - Key
    Perfomance Stats for IIS Servers (avg. 30 second
    refresh)</div>
    <div class="AccordionPanelContent">
    <div spry:region="ds1">
    <table width="100%">
    <tr>
    <th>Server Name</th>
    <th>Active ASP Sessions</th>
    <th>Current Connections</th>
    <th>Wait Time for Last ASP Request</th>
    <th>Queued ASP Requests</th>
    <th>Last Updated</th>
    </tr>
    <tr spry:repeat="ds1">
    <td align="center">{servername}</td>
    <td align="center">{activeSessions}</td>
    <td align="center">{currConnections}</td>
    <td align="center">{requestWaitTime}</td>
    <td align="center">{requestsQueued}</td>
    <td align="center">{timestamp}</td>
    </tr>
    </table>
    </div>
    </div>
    </div>
    <div class="AccordionPanel">
    <div class="AccordionPanelTab">Memory - Free Memory
    Indicators for monitored Servers (avg. 30 second refresh)
    </div>
    <div class="AccordionPanelContent">
    <div spry:region="ds2">
    <table width="100%">
    <tr>
    <th>Server Name</th>
    <th>Free Memory</th>
    <th>Last Updated</th>
    </tr>
    <tr spry:repeat="ds2">
    <td align="center">{servername}</td>
    <td align="center">{memAvailable}</td>
    <td align="center">{timestamp}</td>
    </tr>
    </table>
    </div>
    </div>
    </div>
    <div class="AccordionPanel">
    <div class="AccordionPanelTab">CPU - CPU Usage
    statistics for monitored servers (avg. 30 second
    refresh)</div>
    <div class="AccordionPanelContent">
    <div spry:region="ds3">
    <table width="100%">
    <tr>
    <th>Server Name</th>
    <th>Processor Usage</th>
    <th>Last Updated</th>
    </tr>
    <tr spry:repeat="ds3">
    <td align="center">{servername}</td>
    <td align="center">{procUsage}%</td>
    <td align="center">{timestamp}</td>
    </tr>
    </table>
    </div>
    </div>
    </div>
    <div class="AccordionPanel">
    <div class="AccordionPanelTab">Detailed Server
    Statistics - (avg. 30 second refresh)</div>
    <div class="AccordionPanelContent">
    <div spry:region="ds3">
    <table width="100%">
    <tr>
    <th>Server Name</th>
    <th>Disk Statistics</th>
    <th>Network Statistics</th>
    <th>Services Statistics</th>
    </tr>
    <tr spry:repeat="ds3">
    <td align="center">{servername}</td>
    <td align="center"><a
    href="disk.asp?server={servername}" target="_blank"><img
    src="images/disk.GIF" width="16" height="16"
    /></a></td>
    <td align="center"><a
    href="network.asp?server={servername}" target="_blank"><img
    src="images/network.GIF" width="16" height="16"
    /></a></td>
    <td align="center"><a
    href="services.asp?server={servername}" target="_blank"><img
    src="images/services.GIF" width="16" height="16"
    /></a></td>
    </tr>
    </table>
    </div>
    </div>
    </div>
    </div>
    <script type="text/javascript">
    <!--
    var Accordion1 = new Spry.Widget.Accordion("Accordion1");
    //-->
    </script>
    </body>
    </html>
    Regards
    James
    EDIT: Forgot to mention, I'm using spry 1.5
    pre-release.

    Ok, I think I've tracked this down. It's the loadInterval
    that's causing the issue. If I set all three datasets to refresh at
    the same time, I get the symptoms as above. However, if I stagger
    the loadIntervals (eg, ds1 - 5000, ds2 - 7000,ds3 - 9000) no
    repeated xml requests are seen.
    Is this a limitation of the xmlhttp request, not being able
    to process several requests at the same time?
    Regards
    James
    EDIT
    I've confirmed this now with several other pages. Is there a
    bug in the code somewhere that multiplies the requests??

  • Create flex asset with REST / Javascript / JSON

    Hi
       I was trying to create flex asset by calling REST API with javascript and json. But i am struck in adding mutli valued attribute of type asset. Could you help us with sample code to create asset attribute which is multi valued. Also could you help in adding attribute of type Date. sample code as below
    "name" : "RelatedPlaces",
                            "data" :
                                "assetValue" : "SITE_Place_C:"+ document.getElementById("relPlace").value
    "name" : "EndDate",
                            "data" :
                                "dateValue" : document.getElementById("enddate").value

    There is a sample bundled with webcenter sites at Misc/articles. You have to implement the proxy controller which serve as proxy for xmlhttp request.
    The proxy will redirect the request actual REST resource in the target server

Maybe you are looking for

  • Problem with Preview

    Hello, Quick question - I'm building my portfolio with Adobe Indesign and I'm using the gradient feather tool to create reflections but when I export as a PDF I have two problems when viewing in Preview. The first problem is that the gradient feather

  • Oracle 10G on Win XP

    I would like to know where can I find the instruction to install Oracle 10G on a Win XP machine. I have the following disk: 1. - Oracle DB 10G Rel 3 (10.1.0.2) Windows 32 Bits 2. - Oracle 10G Client And I would like to know if I need to install both

  • Service for Object - MM01/MM02/MM03

    We have activated u201Carchive linku201D to ECM (IBM FileNet Application Connector for SAP® R/3® (ACSAP R/3) for business object for material master transactions (MM01/MM02/MM03), so the images associated with material master can be stored in FileNet

  • Adobe DNG Converter For Panasonic LX3?

    The recent Apple update still does not recognize Panasonic's LX3 camera. I believed I could still get a Raw image into Aperture by doing the following: Using Adobe DNG Converter, and looking at Aperture's requirement that the linear compression optio

  • Ipad 2 Cannot scan for wireless networks

    Why can't my ipad 2 scan for wireless networks?  Was on airport mode but turned airport mode off.  Turned on wi-fi.  Reset network settings.  Tried turning ipad off and turning it back on.  Keep getting same message.  Could not scan for wireless netw