jsp form表单中textarea取不到值
一曲幕终 2016-03-09 10:35:24 jsp:
<form id="commentForm" action="commentWeibo.do" method="post" enctype="multipart/form-data">
<table>
<tr>
<td>
<img src="getFace.do" width="30" height="30" />
<textarea id="commentText" name="commentText" rows="2" cols="50" style="resize:none;" ></textarea>
<img src="images/commentbtn.jpg" width="30" height="30" id="sendComment">
</td>
</tr>
</table>
</form>
js:
document.getElementById("sendComment").onclick = function(){
var value = document.getElementById("commentText").value;
var commentForm = document.getElementById("commentForm");
if(value == ""){
alert("评论不能为空!");
}else{
alert(value);
commentForm.submit();
}
}
document.getElementById("commentText").value可以打印出来值,但是
action中 request.getParameter("commentText") 为NULL