简体   繁体   中英

JSF 1.2 File upload

I am using tomahawk file uploader functionality in my JSF 1.2 using "t:inputFileUpload" tag. But it seems tomahawk is not compatible with JSF 1.2, and it works only with JSF 2.0 and above.

Can someone confirm this. Also it would be great if someone gives pointer how to use file upload in JSF 1.2. I dont want to use RichFaces "rich:fileUpload" as it is too much fancy. I just want simple fileInput field and browse button next to it.

But it seems tomahawk is not compatible with JSF 1.2, and it works only with JSF 2.0 and above.

This is not true. Tomahawk existed almost as long as JSF itself. It's definitely also available in a JSF 1.2 compatible version.

Apparently you downloaded Tomahawk for JSF 2.0 instead of Tomahawk for JSF 1.2. Tomahawk has admittedly very confusing version numbers. It uses exactly the same 1.1.x version number for both JSF 1.2 and 2.0 versions.

When starting at the Tomahawk download page , you should for JSF 1.2 be downloading the version which is listed as follows:

MyFaces Tomahawk 1.1.14 for JSF 1.2 (zip) tomahawk12-1.1.14-bin.zip

and thus not the version which is listed as follows:

MyFaces Tomahawk 1.1.14 for JSF 2.0 (zip) tomahawk20-1.1.14-bin.zip

For a more detailed answer as to how to setup it, see also Uploading files with JSF (1.2) .

Richfaces' file upload is good enough. Its view can be customized by overriding corresponding styles, see the reference for tag , Table 6.183 and below.

tomahawk lib has no problem with jsf 1.2, example for file uploading tag,

<h:form id="uploadForm" name="uploadForm" enctype="multipart/form-data">
                <table>
                <tr>
                    <h:outputText for="photo" value="Select File: " />
                   <t:inputFileUpload storage="file" size="40" id="photo" value="#{patientsBackingBean.patientPhoto}"/>
                    <h:message for="photo" style="color: red;" />
                </tr>
                </table>
 </h:form>

here patientPhoto have to declare as UploadedFile in backing bean.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM