Life...as I have experienced it by far...

Friday, August 21, 2009

Life is Beautiful

Life is beautiful

Life is beautiful he says………………..

Is it because,

It gives us a will that makes us search the sunshine peeking through the darkest clouds...

A spirit that inspires us fight the unseen, untouched doubts...

An inspiration that makes us trek the forlorn roads...

And at the end of a tiring day...

It also does promise to open the doors of the heavenly abode...


Maybe it is so as...

Amongst a swarm of unknown faces, it made a face special,

Gave us beautiful memories to wash off the pain of lonesome hours...

Made us believe on the undying spirit of the soul that carved out these new ways...

Stroked us a touch that made the sacred heart believe,

the blooming fragrance was just a step away...


So when at times I feel life has not been fair, he says...

Give a thought again my friend...

I am sure you will find several reasons solemnizing…..


It might have been a journey with tiring and windy uphill terrains,

But it also sanctified us with thousands of springs, wishful summers and wonderful rains...



~ Dhira Sarkar



Monday, March 23, 2009

AJAX

Recently, I worked on AJAX for the first time to create a small application for the web-based product I am working on. I have faced few issues and resolved them. This blog is about some important points about AJAX which one should take care.

For XML Response:
  • Set the content type to "text/xml". Eg. response.setContentType("text/xml");
  • Before creating the XML content always clear the buffer. Calling clearBuffer() of JspWriter is better than calling just clear() method as the earlier won't throw any exception. Eg. out.clearBuffer();
  • While creating the XML content there has to be a root element. Eg.
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<list>
<student>
<id>990</id>
<name>Sujoy C</name>
</student>
<student>
<id>991</id>
<name>Tanmoy C</name>
</student>
</list>

To Post Data:
  • Set the content type of request header to "application/x-www-form-urlencoded"
  • Create the post parameters and set the content length. eg. xmlReqObj.setRequestHeader("Content-length", params.length);
  • Code example:
var xmlReqObj = new XMLHttpRequest();

try

{

xmlReqObj.open("POST", URL, true);

xmlReqObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

xmlReqObj.setRequestHeader("Content-length", params.length);

xmlReqObj.setRequestHeader("Connection", "close");



xmlReqObj.send(params);

} catch(err)

{}



I shall try the following things and keep posted:
  1. How can I pass argument to the function onreadystatechange?
  2. The status attribute most of the time throws error. Why does this happen and how to resolve this?