SSH文件上传:并且使用了jQuery异步同步form插件。
Action部分:
private File file; private String fileFileName; private String fileContentType; @Action("upload") public void edit(){ do something.... } get and set...
Html部分:
<script src="jquery.1.x.x.js"></script> <script src="jquery.form.js"></script> <script> $(function() { $("#postForm").ajaxForm({ url: "/upload", // 请求的url type: "post", // 请求方式 dataType: "text", // 响应的数据类型 async: true, // 异步 success: function (data) { alert(data); }, error: function () { alert("数据传输失败!"); } }); }); </script> <form id="postForm" action="/app/appBanner_edit" method="post"> 上传文件:<input name="file" type="file" /><br> <input type="button" onclick="$('#postForm').submit();" value="保存"/> </form>
6的死