日期:2014-05-20 浏览次数:20803 次
public String saveSearch() throws Exception { // TODO Auto-generated method stub String s=ServletActionContext.getRequest().getParameter("guo"); HttpServletResponse response = ServletActionContext.getResponse(); PrintWriter out=response.getWriter(); ServletActionContext.getResponse().getWriter().write("your output String"); System.out.println(s+"==-"); return null; }
<script type="text/javascript" src="<%=request.getContextPath() %>/common/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="<%=request.getContextPath() %>/common/js/jquery.form.js"></script> <SCRIPT type="text/javascript"> $(document).ready(function() { var options={ target:'#output1', url:"<%=request.getContextPath() %>/search/saveSearch", beforeSubmit:function(){ alert("pre"); }, success: function(data){ alert("post"); } }; $("#searchForm").submit(function() { $(this).ajaxSubmit(options); return false; }); }); </SCRIPT>