AJAX call from theme jsp - Websphere

This is a discussion on AJAX call from theme jsp - Websphere ; Hi I am working on WAS6. As per my requirement i have to do the AJAX call from theme jsp (banner.jsp or default.jap). code is as follow. I put the servlet under shared/app folder. This code is working fine from ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: AJAX call from theme jsp

  1. AJAX call from theme jsp

    Hi

    I am working on WAS6. As per my requirement i have to do the AJAX call from theme jsp (banner.jsp or default.jap). code is as follow. I put the servlet under shared/app folder. This code is working fine from portlet jsp but from theme jsp it is not calling the servlet at all. request is not going to servelt.



    var AJAX_SERVLET = " ";

    var READY_STATE_COMPLETE=4;
    var HTTP_OK = 200;
    var currentTab = 1;
    var mbrGrpID="";
    function changeAccount(selectOption) {
    if(selectOption.options.selectedIndex == 0){
    return false;
    }
    else{
    mbrGrpID = selectOption.options[selectOption.selectedIndex].value;
    var confirmStatus = confirm("Do You wish To Change Account?");
    if(confirmStatus){
    alert('inside if condition::'+mbrGrpID)
    getUserContextServlet(mbrGrpID);
    return true;
    }
    }
    }

    function getXMLHttpRequest() {
    var httpRequest = null;
    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    httpRequest = new XMLHttpRequest();
    if (httpRequest.overrideMimeType) {
    httpRequest.overrideMimeType('text/xml');
    }
    }
    else if (window.ActiveXObject) { // IE
    try {
    httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
    httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }
    }

    if (!httpRequest) {
    alert('Giving up Cannot create an XMLHTTP instance');
    return false;
    }
    return httpRequest;
    }


    /**
    * This will submit an AJAX request to retrieve alternates and substitutions
    * for the specified CIN.
    *
    * @param cin The cin.
    */
    function getUserContextServlet(mbrGrpID) {
    var servletURL = "UserContextServlet?memberGroupId="+mbrGrpID;
    makeGetRequest(servletURL);
    }


    /**
    * Makes the AJAX servlet request.
    *
    * @param servlet The servlet name (for servlet calls).
    * @param callbackFunction The callback function.
    */
    function makeGetRequest(servlet) {
    alert('make request11');

    xhr_getSchemas = getXMLHttpRequest();
    xhr_getSchemas.onreadystatechange = callbackFunction;
    xhr_getSchemas.open("GET", AJAX_SERVLET + "/" + servlet, true);
    xhr_getSchemas.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
    xhr_getSchemas.send('');

    alert(xhr_getSchemas);
    }

    /**
    * The callback method for the alternates and substitutes AJAX call.
    */
    function callbackFunction() {
    alert('call back function')
    if (xhr_getSchemas.readyState == READY_STATE_COMPLETE) {
    alert('READY_STATE_COMPLETE dd')

    alert('HTTP_OK')

    document.location = " ";


    }
    }





    Please let me know if i have to do any changes. What should be the location of servlet.

    Thanks
    Monu

  2. Re: AJAX call from theme jsp

    Hi
    i need some inf from you.

    what jar files are include to implement the ajax framwork.
    where should i download , can you please send me the url.
    Thanks

+ Reply to Thread