Question: I'm experiencing different results when I use these two bits of code. To me, they should be equivalent. What is the difference?

```
var mapString = '<map id="map"><area shape="poly" coords="52,21,92,21,92,196,52,196"></map>';

//  First option:
$('#map').replaceWith(mapString);

//  Second option:
var mapParent = $('#map').parent();
$('#map').remove();
$(mapString ).appendTo(mapParent);

```

The first option replaces the existing map DOM element with a new map element represented as a string. The second option removes the existing map DOM element and then appends a new map element.

Shouldn't these be the same...? It appears that my map's area doesn't refresh when calling replaceWith.

EDIT: Does the first not cause a browser repaint where the second one does?

Answer: 
I think you will have to add below initbinder inside your controller,which will convert to the required format.

```
@InitBinder
public void initBinder(WebDataBinder binder) {
    CustomDateEditor editor = new CustomDateEditor(new SimpleDateFormat("dd-MMMM-yy"), true);
    binder.registerCustomEditor(Date.class, editor);
}

```

Also use below annotation for date field in Student class.

```
@DateTimeFormat(pattern = "dd-MMMM-yy")
private Date dateOfBirth;

@DateTimeFormat(pattern = "dd-MMMM-yy")
private Date dateOfJoining;

```
```css
@DateTimeFormat(pattern = "dd-MMMM-yy")
private Date dateOfBirth;

@DateTimeFormat(pattern = "dd-MMMM-yy")
private Date dateOfJoining;
```

These Lines solved my problem... Thanks Mr. @RE350