<p>is it possible to include a servlet in a jsp page? if so how?</p>

To give another alternative, i.e. instead of cloning the whole object you can copy the data object to a new array containing name/value pairs followingly:
```
```
function getOriginalElementData(domElementJQueryObject){
    var originalElementData = new Array();
    $.each(domElementJQueryObject.data(),function(name,value) {
       originalElementData.push({"name":name,"value":value});
    });

    return originalElementData;
}
```
```
To restore the data to another object:
```
```
function restoreOriginalElementData(domElementJQueryObject,originalElementData){
    for(var i=0;i<originalElementData.length;i++){
        domElementJQueryObject.data(originalElementData[i].name,originalElementData[i].value);
    }
}
```
```
The part to iterate through the data items is copied from this answer:
jQuery loop through data() object