struts2 file

JavaBean 中:

private File[] pic;

private String[] picContentType;

private String [] picFileName;

setter  getter

-------------------------------------------------------------------------

Action中:

JavaBean javaBean

setter getter

--------------------------------------------------------------------------

JSP中:

<form action="aaaa" method="post" enctype="multipart/form-data">

<s:file name="javaBean.pic" />

<s:file name="javaBean.pic" />

-------------------------------------------------------------------------

约定:xxx,xxxContentType,xxxFileName

时间: 2024-08-26 07:39:17

struts2 file的相关文章

struts2 File标签上传文件

1.action.class private File pictureType; private String pictureTypeContentType; private String pictureTypeFileName; public String editType() throws IOException{ Type t=typeService.find(Type.class, id); System.out.println("id="+id); System.out.pr

Struts2单文件上传原理及示例

一.文件上传的原理 表单元素的enctype属性指定的是表单数据的编码方式,该属性有3个值: 1.application/x-www-form-urlencoded:这是默认编码方式,它只处理表单域里的value属性值,采用这种编码方式的表单会将表单域的值处理成URL编码方式. 2.multipart/form-data:这种编码方式的表单会以二进制流的方式来处理表单数据,这种编码方式会把文件域指定文件的内容也封装到请求参数里. 3.text/plain:这种方式主要适用于直接通过表单发送邮件的

idea+struts2配置struts.xml时struts-default出错

在idea中创建struts2项目时,在配置文件struts.xml的extends="struts-default"中,struts-default一直标红. 解决方法: File -> Project Structure -> Modules -> Web -> Struts2 -> File Sets 在Default File Set中点击"+",将struts.xml和struts-default.xml放在一个组里.

struts2 CVE-2012-0392 S2-008 Strict DMI does not work correctly allows remote command execution and arbitrary file overwrite

catalog 1. Description 2. Effected Scope 3. Exploit Analysis 4. Principle Of Vulnerability 5. Patch Fix 1. Description Struts2框架存在一个DevMode模式,方便开发人员调试程序.如果启用该模式,攻击者可以构造特定代码导致OGNL表达式执行,以此对主机进行入侵Remote command execution and arbitrary file overwrite, St

Struts2 ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging

在做struts2时导包完成发现Struts2 ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging log4j2的配置文件没找到去struts2-blank下.WEB-INF\classes下找到log4j的配置文件log4j2.xml:把他放入src中

ie下ajaxSubmit提交form中包含file时,提示下载(后台采用struts2)

原因:主要是后台传回的数据的响应方式,默认是application/***,要将其修改成text/html,这样返回的是字符串,到前台,如果需要可以将其转成所需格式 解决方案: 前台 提交前的校验 1 var validateForm = function() { 2 var flag = true; 3 if (window.ActiveXObject) { 4 IE下的处理……修改flag11 } else if (window.MessageEvent && !document.ge

Struts2学习---namespace,file模块包含,默认action

我们上一节已经将action基本的配置和使用讲了,接下来我们讲以下struts一些小知识点: namespac: 上一节学习action的时候我们访问我们jsp文件时候使用的: http://localhost:8080/testStruts2/hello 这个路径,有同学就会问,为啥只能用这个路径, 其实我们也可以用: http://localhost:8080/testStruts2/hello.action 这两种是默认的方法,但是同样我们也可以自定义. <package name="

Struts2配置拦截器自定义栈时抛异常:Unable to load configuration. - interceptor-ref - file:/D:/tomcat_install/webapps/crm/WEB-INF/classes/struts.xml

代码如下: <interceptors>  <!-- 注册自定义拦截器 -->   <interceptor name="LoginInterceptor" class="com.hncj.crm.staff.web.action.LoginInterceptor"></interceptor>   <!--自定义栈  -->   <interceptor-stack name="crmSt

解决myeclipse中struts2 bug问题包的替换问题

因为struts2的bug问题,手工替换还是比较麻烦,但即便是最新的myeclipse2014也没有替换最新的struts2包,研究了一天,终于找到了解决办法.以下就解决方法与大家分享一下. 1.在perferences中找到 Myeclipse->Project Libraries,右边找到 struts2.1 Libraries,点击 Enable advanced configiguration,去掉以下文件前面的对勾,然后点击 Add custom Jars 2.在弹出的对话框中选择 A