This discussion is archived
7 Replies Latest reply: May 22, 2012 11:29 PM by 164415 RSS

Struts 2: File upload does not work on Weblogic v12c

peter.keller Newbie
Currently Being Moderated
Dear list

In a Struts 2 application using v2.3.1.2, the file upload from a JSP page with "multipart/form-data" does not work anymore on Weblogic v12c which supports Java Servlet specification v3.0. The same application worked on v10.3.2 which supports Java Servlet specification v2.4:

* The "method" attribute in the <s:submit> tag is ignored. Struts always invokes the execute() method of the Struts action.
* If you use the execute() method for the upload (with the according changes in the action and JSP page), none of the parameters (data, dataContentType, dataFileName, contentTx) are transferred to the Struts action
* The same code does not work with the older Struts v2.1.8 on Weblogic v12c

Please find the setup below.

Is this is a bug? Or is something wrong with my setup?

Thanks, Peter


<?xml version='1.0' encoding='ISO-8859-1'?> <web-app xmlns=""

     <description>Datadispatcher Console</description>
     <display-name>Datadispatcher Web</display-name>

          <description>Tiles configuration file</description>








<?xml version="1.0" encoding="UTF-8" ?>
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"

<constant name="struts.devMode" value="false" />
<constant name="struts.multipart.saveDir" value="/tmp" />
<constant name="struts.i18n.encoding" value="ISO-8859-1" />

<package name="dd-default" extends="struts-default">
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/>
<default-interceptor-ref name="defaultStack"/>
<action name="Upload" class="ch.meteoswiss.datadispatcher.console.UploadAction">
<result type="tiles"></result>
<result name="input" type="tiles"></result>


<%@ taglib prefix="s" uri="/struts-tags" %>
<s:form method="post" enctype="multipart/form-data" action="Upload" theme="simple"> <table>
<tr><td>Content Id</td><td><s:textfield name="contentTx" size="20"/></td></tr>
<tr valign="middle"><td>Import File</td><td><s:file name="data" size="60"/></td></tr> </table>
<s:submit value="Upload" method="upload"/> </s:form>

Java Action:

package ch.meteoswiss.datadispatcher.console;

public class UploadAction extends ActionSupport {

private static final Logger logger = Logger.getLogger(UploadAction.class);

private String contentTx;

private File data;
private String dataContentType;
private String dataFileName;

public String execute() {"**** execute ****");
return super.execute();

public String upload() throws Exception {"**** upload ****");"data = "+data);"contentTx = "+contentTx);
return SUCCESS;
public void setContentTx(String contentTx) {
this.contentTx = contentTx;
public String getContentTx() {
return contentTx;
public void setData(File data) { = data;
public File getData() {
return data;
public void setDataContentType(String dataContentType) {
this.dataContentType = dataContentType;
public String getDataContentType() {
return dataContentType;
public void setDataFileName(String dataFileName) {
this.dataFileName = dataFileName;
public String getDataFileName() {
return dataFileName;

Edited by: kep on 30.01.2012 14:53


  • Correct Answers - 10 points
  • Helpful Answers - 5 points