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?

0

1 Answer 1

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:

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.