添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
坚韧的跑步鞋  ·  Layui ...·  1 月前    · 
神勇威武的感冒药  ·  Activities - Add ...·  1 月前    · 
听话的感冒药  ·  Upload multiple files ...·  1 月前    · 
从未表白的柠檬  ·  将PHP ...·  3 月前    · 
挂过科的板栗  ·  DirectX 9 ...·  4 月前    · 
被表白的大葱  ·  经济50人论坛·  4 月前    · 
想发财的洋葱  ·  pcre2_match - man ...·  5 月前    · 
淡定的油条  ·  Visual Studio 2022 ...·  5 月前    · 

表单可实现无刷新页面提交,无需页面跳转,如下,通过一个隐藏的iframe实现,form表单的target设置为iframe的name名称,
form提交目标位当前页面iframe则不会刷新页面 <form action="/url.do" method="post" target="targetIfr"> <input type="text" name="name"/> </form> <iframe name="targetIfr" style=""></iframe> <form action="/url.do" method="post"> <input type="text" name="name"/> <input type="submit" value="提交"> </form>

采用ajax异步方式,通过js获取form中所有input、select等组件的值,将这些值组成Json格式,通过异步的方式与服务器端进行交互,
一般将表单数据传送给服务器端,服务器端处理数据并返回结果信息等 <form id="form" method="post"> <input type="text" name="name" id="name"/> </form> var params = {"name", $("#name").val()} $.ajax({ type: "POST", url: "/url.do", data: params, dataType : "json", success: function(respMsg){ <form action="/url.do" method="post"> <input type="text" name="name"/> <input type="submit" value="提交"> </form> @RequestMapping(value = "/url") public void exportFile(HttpServletRequest req, HttpServletResponse response, String rptId) throws Exception { OutputStream out = null; try { String rptName = "file"; String fileName = new String((rptName + excelAble.getFileSuffix()).getBytes("GBK"), "8859_1"); response.reset(); response.setContentType("application/octec-stream"); response.setHeader("Content-disposition", "attachment; filename=" + fileName); out = response.getOutputStream(); excelAble.exportFile(out); } catch (Exception e) { logger.error(e); } finally { if (out != null) { out.close();

使用form表单进行上传文件需要为form添加enctype="multipart/form-data" 属性,除此之外还需要将表单的提交方法改成post,
如下 method="post", input type的类型需要设置为file <form action="/url.do" enctype="multipart/form-data" method="post"> <input type="file" name="name"/> <input type="submit" value="提交"> </form>