Author: konstantin.mishin
Date: 2007-11-29 14:05:02 -0500 (Thu, 29 Nov 2007)
New Revision: 4363
Modified:
trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml
trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
Log:
RF-1214
Modified: trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java 2007-11-29
19:03:15 UTC (rev 4362)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java 2007-11-29
19:05:02 UTC (rev 4363)
@@ -20,10 +20,41 @@
*/
package org.richfaces;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.richfaces.org.jboss.seam.ui.component.UIFileUpload;
+
/**
* @author $Autor$
*
*/
public class Bean {
+ private UIFileUpload fileUpload;
+
+ public UIFileUpload getFileUpload() {
+ return fileUpload;
+ }
+
+ public void setFileUpload(UIFileUpload fileUpload) {
+ this.fileUpload = fileUpload;
+ }
+
+ public void printFile() {
+ int i = -1;
+ InputStream stream = fileUpload.getLocalInputStream();
+ do {
+ try {
+ i = stream.read();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ System.out.print((char)i);
+ } while (i!=-1);
+ System.out.println();
+
+ }
}
\ No newline at end of file
Modified: trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/faces-config.xml 2007-11-29
19:03:15 UTC (rev 4362)
+++
trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/faces-config.xml 2007-11-29
19:05:02 UTC (rev 4363)
@@ -5,6 +5,6 @@
<managed-bean>
<managed-bean-name>bean</managed-bean-name>
<managed-bean-class>org.richfaces.Bean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
Modified: trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml 2007-11-29
19:03:15 UTC (rev 4362)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml 2007-11-29
19:05:02 UTC (rev 4363)
@@ -17,7 +17,20 @@
<filter-name>ajax4jsf</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
+ <filter>
+ <display-name>FileUpload Filter</display-name>
+ <filter-name>fileUpload</filter-name>
+
<filter-class>org.richfaces.org.jboss.seam.web.MultipartFilter</filter-class>
+ </filter>
<filter-mapping>
+ <filter-name>fileUpload</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ <dispatcher>ERROR</dispatcher>
+ </filter-mapping>
+ <filter-mapping>
<filter-name>ajax4jsf</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
Modified: trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp 2007-11-29
19:03:15 UTC (rev 4362)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp 2007-11-29
19:05:02 UTC (rev 4363)
@@ -1,12 +1,16 @@
<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://labs.jboss.com/jbossrichfaces/ui/ui/fileUpload"
prefix="fu"%>
<html>
<head>
<title></title>
</head>
<body>
<f:view>
-
+ <h:form enctype="multipart/form-data" >
+ <fu:fileUpload binding="#{bean.fileUpload}"></fu:fileUpload>
+ <h:commandButton type="submit"
action="#{bean.printFile}"></h:commandButton>
+ </h:form>
</f:view>
</body>
</html>