1

I want to upload files in a JSF 1.1 project. JSF 1.1 doesn't support RichFaces file upload. I looked at Tomahawk, but I don't know how to use Tomahawk. Can anybody explain for me?

  • Which JARs do I have to use?
  • And taglibs?
  • And web.xml configuration?
  • And faces-config.xml configuration?

Or are there alternatives to Tomahawk?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
kenan altan
  • 41
  • 3
  • 6

1 Answers1

4

Which JARs do I have to use?

The following ones:

I assume that you already have the JSF 1.1 JARs jsf-api and jsf-impl.


And taglibs?

Just the Tomahawk one, next to the two usual core/html tags:

<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>

And web.xml configuration?

You need the ExtensionsFilter. This filter will take care that JSF gets the right parameters out of a multipart/form-data request body.

<filter>
    <filter-name>Extensions Filter</filter-name>
    <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>Extensions Filter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

And faces-config.xml configuration?

Nothing special. Just create a managed bean the usual way with a UploadedFile property which you bind to the value attribute of <t:inputFileUpload>.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555