在JavaScript中使用window.location.href提交表单时,必须要传参,否则servlet是无法根据request.getParameter("");来取值的
可以通过$("#test").val();来获取标签值并传参
HTML
<input id="test" name="test">
<button id="search">异步提交</button>
JavaScript
<script src="js/jquery.min.js"></script>
<script>
//异步刷新
$("#search").on("click",function(){
var test=$("#test").val();
window.location.href="AutoAnswerServlet?test="+test;
});
</script>