; //flag为id、name属性名 $.ajaxFileUpload({ url: 'uploadAjax.htm', type: 'post', secureuri: false, //一般设置为false fileElementId: 'file'

, // 上传文件的id、name属性名 dataType: 'text'
, //返回值类型,一般设置为json、application/json elementIds: elementIds, //传递参数到服务器 success: function(data, status){ alert(data); }, error: function(data, status, e){ alert(e); } });
1、你的页面在Web-Root下,内容为:
3、后台处理接收到的内容: request.setcharactorEncoding("utf-8"); String userName = request.getParameter("userName"); rESPonse.setCharactorEncoding("utf-8"); PringWriter out = response.getWriter(); out.print("{"msg":"你好~~"+userName+"!"}"); 注意事项: 1、这里的编码统一为utf-8 2、请求路径servlet/helloWorldServlet为相对路径,因此你的页面必须在项目的Web-Root下(也就是默认的web文件夹下,名字可能因项目配置不同而改变) 3、没了,记得给分哦,打字很辛苦的~