Forums de discussion

File upload of using Tomahawk

Naoya Mekaru, modifié il y a 10 années.

File upload of using Tomahawk

New Member Publications: 12 Date d'inscription: 19/07/13 Publications récentes
I have a big problem.

The file was uploaded using the Tomahawk.
However, it does not work well.

How can I resolve this error?
WARNING: JSF1064: Unable to find or serve resource, inputFileUpload.xhtml, from library, org.apache.myfaces.custom.


web.xml

<!--?xml version="1.0"?-->

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

	<context-param>
		<param-name>com.sun.faces.expressionFactory</param-name>
		<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
	</context-param>
	<context-param>
		<param-name>javax.faces.PROJECT_STAGE</param-name>
		<param-value>Development</param-value>
	</context-param>
	<servlet>
		<servlet-name>Faces Servlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<filter>
		<filter-name>MyFacesExtensionsFilter</filter-name>
		<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
		<init-param>
			<param-name>uploadMaxFileSize</param-name>
			<param-value>20m</param-value>
		</init-param>
	</filter>

	<!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages  -->
	<filter-mapping>
		<filter-name>MyFacesExtensionsFilter</filter-name>
		<!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
		<servlet-name>Faces Servlet</servlet-name>
	</filter-mapping>

	<!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.)  -->
	<filter-mapping>
		<filter-name>MyFacesExtensionsFilter</filter-name>
		<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
	</filter-mapping>
</web-app>


xhtml

<!--?xml version="1.0"?-->

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk">
	<h:head />
	<h:form enctype="multipart/form-data">
		<table>
			<tbody><tr>
				<th><h:outputtext value="アップロードファイル" /></th>
				<td>
					<t:inputfileupload value="#{messageBean.file}" id="upfile" storage="file"></t:inputfileupload>
				</td>
				<td>
					<h:commandbutton action="#{messageBean.fileUpload()}" value="アップロード" />
				</td>
			</tr>
		</tbody></table>
	</h:form>
</ui:composition>



ManagedBean
package mybean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import org.apache.myfaces.custom.fileupload.UploadedFile;

@ManagedBean
@SessionScoped
public class MessageBean {

	private UploadedFile file;

	public void fileUpload() {
		System.out.println("test");
	}

	public UploadedFile getFile() {
		return file;
	}

	public void setFile(UploadedFile file) {
		this.file = file;
	}
}


jarfile
 ・batik-awt-util-1.6-1.jar
 ・batik-ext-1.6-1.jar
 ・batik-gui-util-1.6-1.jar
 ・batik-util-1.6-1.jar
 ・commons-beanutils.jar
 ・commons-beanutils-1.7.0.jar
 ・commons-codec-1.3.jar
 ・commons-collections.jar
 ・commons-collections-3.2.1.jar
 ・commons-digester.jar
 ・commons-digester-1.6.jar
 ・commons-el-1.0.jar
 ・commons-fileupload.jar
 ・commons-fileupload-1.2.1.jar
 ・commons-io.jar
 ・commons-io-1.3.2.jar
 ・commons-lang.jar
 ・commons-lang-2.4.jar
 ・commons-logging-1.1.1.jar
 ・commons-validator-1.3.1.jar
 ・oro-2.0.8.jar
 ・tomahawk20-1.1.14.jar
 ・xml-apis-1.0.b2.jar
 ・xmlParserAPIs-2.0.2.jar

I'm very helpless.
Please help someone.
thumbnail
Neil Griffin, modifié il y a 10 années.

RE: File upload of using Tomahawk

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Are you developing a JSF webapp or a JSF portlet?
Naoya Mekaru, modifié il y a 10 années.

RE: File upload of using Tomahawk

New Member Publications: 12 Date d'inscription: 19/07/13 Publications récentes
Yes. I have developed a JSF portlet.

The uploaded file is not mapped to the field of ManagedBean.
I do not understand what is the problem.

Please advice
I suffer for three days. .
thumbnail
Neil Griffin, modifié il y a 10 années.

RE: File upload of using Tomahawk (Réponse)

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Tomahawk is not a supported JSF component library for Liferay portlets. I would recommend that you look at the source for the jsf2-portlet demo since it has a working file upload example using bridge:inputFile. ICEfaces, PrimeFaces, and RichFaces have Ajaxified file upload components that work too.