我现在初学struts2啊,我有一个页面里显示一下从action中传递出来的内容,这个页面里还有一个表单,里面有几个文本框,提交和重置按钮。现在碰到的问题是当我将表单内容提交到action中了以后,下一次再进入这个页面时发现里面的内容是上次提交时的内容,点击重置按钮也只能重置到上次提交的内容而不能将文本框变空。我有试过jquery但是好像不管用。请问各位大神应该要怎么办呢?谢谢。
代码差不多是这样的:
JQuery:
<script src="jquery/jquery-1.11.1.js" type="text/javascript">
$(document).ready(function(){
$(“#title”').text("");
$("#reset").click(function(){
$("#title").text("");
});
});
</script>
HTML:
<form id="form1" method="post" action="addSingleChoice.action">
.....................
<s:textfield name="title" theme="simple" id="title"/> <!-- 要重置的文本框--!>
.....................
<input type="submit" name="submit" id="submit" value="提交" />
<input type="reset" name="reset" id="reset" value="重置" />
</form>
------解决方案--------------------
补充下:document.getElementById(“title”).value = "";
------解决方案--------------------
兄弟,我担心的事,
<s:textfield name="title" theme="simple" id="title"/>这个标签有没把数据带过来