Loading
DOJO Example

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  DOJO Example


Ans)


As mentioned in one of the above questions, DOJO is one of the popular Ajax Technologies
which enables you to

make HTTP calls Asyncronously.

Step 1:
Include DOJO libraries (.js files)

 <script type="text/javascript" src="<c:url value="/includes/dojo_nav/js/
 dojo-release-0.9.0/dojo/dojo.js"/>"></script>
 <script type="text/javascript" src="<c:url value="/includes/dojo_nav/js/
 dojo-release-0.9.0/dojo/parser.js"/>"></script>
 
Step 2:

Write Java Script method to make a Serverside call.

function fillContactFields() {
  
 dojo.xhrGet( {
        url: "<c:url value="/populateContact.do"/>",
        handleAs: "json",
  form: dojo.byId("populateContactForm"),
        load: function(response) {
  populateSiteFields(response);
          return response;
        },
        // The ERROR function will be called in an error case.
        error:  function(type, data, evt){alert("Error");}
       });

}

Step 2:
Display the result in whichever way to want.

//function populateContactFields(type, data, evt) {
function populateSiteFields(data) {
    var contactId, address1, address2, city, state, zip, contactName, siteTenantType;
    contactId = document.forms[0].contactId;
    contactId.value = "0";
  
    if (data.contactId) {
       contactId.value = data.contactId;          
    }
    address1 = document.getElementById("address1");
    address1.value = "";
    if (data.address1) {
        address1.value = data.address1;
    }

    address2 = document.getElementById("address2");
    address2.value = "";
    if (data.address2) {
        address2.value = data.address2;
    }

    city = document.getElementById("city");
    city.value = "";
    if (data.city) {
        city.value = data.city;
    }

    state = document.getElementById("state");
    state.vaue = "";
    if (data.state) {
        state.value = data.state;
    }

    zip = document.getElementById("zip");
    zip.value = "";
    if (data.zip) {
        zip.value = data.zip;
    }

    siteName = document.getElementById("siteName");
    siteName.value = "";
    if (data.siteName) {
        siteName.value = data.siteName;
    }
}



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

DOJO Example


DOJO Example

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free