ITeye博客

Struts2

共 3 篇文章

struts2之单个文件上传

通过2种方式模拟单个文件上传,效果如下所示 开发步骤如下: 1、新建一个web工程,导入struts2上传文件所需jar,如下图 目录结构 2、新建Action 第一种方式 package com.ljq.action; import java.io.File; import org.apache.commons.io.FileUtils; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.Ac…

2013-11-14 13:04 · Struts2

jquery .form.js 文件上传返回json与Strut2冲突的异常:提示下载

当用jqueryForm提交表单需要返回json类型的数据时,后台需要设置Response的contentType属性为“text/html” 但当我们使用Struts2Utils.renderJson(args)时就会提示下载,虽然我们设置了contentType属性,原因在于 Struts2Utils.renderJson(args)方法内部又设这了一遍contentType属性,如下 HttpServletResponse response = initResponseHeader("application/json", headers); 它覆盖了我们的设置,所以要想用jqueryF…

2013-08-11 18:19 · javascript · JAVA · Struts2

Struts2 Action 只做页面跳转用的配置

<action name="*" class="com.opensymphony.xwork2.ActionSupport"> <result type="freemarker">{1}.ftl</result> </action>

2012-05-01 08:42 · Struts2