使用ajax在struts2中上传文件 [英] upload file in struts2 using ajax

查看:33
本文介绍了使用ajax在struts2中上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 struts 2 中使用 ajax 上传文件

How can I upload a file in struts 2 using ajax

推荐答案

下载 Struts2 jQuery 插件 和像平常使用 Struts2 那样做.

Download the Struts2 jQuery Plugin and do it like you normaly do it with Struts2.

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<html>
  <head>
    <sj:head/>
  </head>
  <body>
    <s:form id="form" action="AjaxTest">
      <s:file name="myFile" ... />
      <sj:submit value="Submit Form" targets="myAjaxTarget"/>
    </s:form>
    <div id="myAjaxTarget">
    </div>
  </body>
</html>

这篇关于使用ajax在struts2中上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆