<form:input path="patientid"/>
is not html.
This should get you started:
<td width="75">Patient ID<font color="red">*</font></td>
<td width="166"><input type="text" id="patientid" onchange="
this.value==='' && alert( 'I am empty' );
"/></td>
Or you could try to do this:
<td width="75">Patient ID<font color="red">*</font></td>
<td width="166"><input type="text" id="patientid" onchange="
this.value==='' && (this.value='I cannot be empty');
"/></td>