Hello,
Firstly, apologies if this should be in the javascript forum - I wasnt sure which was most appropriate to post this question in...
I am not sure if my problem is caused by the way I am mixing java and javascript in my jsp and if it can be fixed.
If currentObservation.getComment() (java) is not null then all is well. But if it is null, instead of just setting document.commentForm.commentBox.value to a blank string I get a java.lang.NullPointerException.
Am I testing for null incorrectly, or is it impossible to mix java and javascript quite like this?!
-
<script language="JavaScript" type="text/javascript">
-
var commentValue = "";
-
<%if(currentObservation.getComment()!=null){%>
-
document.commentForm.commentBox.value="<%=currentObservation.getComment()%>";
-
<%}else{%>
-
document.commentForm.commentBox.value = "";
-
<%}%>
-
document.commentForm.commentBox.value = "";
-
document.commentForm.remLen.value = (1000 - commentValue.length);
-
//-->
-
</script>
any help gratefully received