1

JSF 1.1 プロジェクトでファイルをアップロードしたいと考えています。JSF 1.1 は、RichFaces ファイルのアップロードをサポートしていません。トマホークを見たけど、トマホークの使い方がわからない。誰か説明してくれませんか?

  • どの JAR を使用する必要がありますか?
  • そしてタグライブラリ?
  • そしてweb.xml構成?
  • そしてfaces-config.xml構成?

または、トマホークの代替品はありますか?

4

1 に答える 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:

于 2011-09-23T01:00:00.700 に答える