You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/03/17 11:55:13 UTC

svn commit: r1735403 - /myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/upload.xhtml

Author: lofwyr
Date: Thu Mar 17 10:55:12 2016
New Revision: 1735403

URL: http://svn.apache.org/viewvc?rev=1735403&view=rev
Log:
TOBAGO-1544: Revise Demo Application for Tobago 3.0

Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/upload.xhtml

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/upload.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/upload.xhtml?rev=1735403&r1=1735402&r2=1735403&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/upload.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/upload.xhtml Thu Mar 17 10:55:12 2016
@@ -25,39 +25,50 @@
   <ui:param name="title" value="File Upload"/>
   <tc:panel id="panel">
 
-    <p>
-      To load up files to the server for JSF 2.0 and 2.1 you will need to
-      add an multipart-config entry to the FacesServlet in the <code>web.xml</code> file.
-      Since JSF 2.2 this is not required.
-    </p>
-
-    <p>
-      Here you can configure some more general information.
-    </p>
-
-    <pre><code class="language-markup">
-      &lt;multipart-config>
-        &lt;location>/tmp&lt;/location>
-        &lt;max-file-size>20848820&lt;/max-file-size>
-        &lt;max-request-size>418018841&lt;/max-request-size>
-        &lt;file-size-threshold>1048576&lt;/file-size-threshold>
-      &lt;/multipart-config>
-    </code></pre>
-
-    The first example loads up an arbitrary file. The second example contains a <code>&lt;tc:validateFileItem></code>
-    tag with restrict the content type.
-
-    <tc:file label="Upload file:" value="#{upload.file1}" tip="without extra validation" id="file1"/>
-
-    <tc:file label="Upload image:" value="#{upload.file2}" id="file2"
-             tip="with a validator for file items - types: gif, jpg, png">
-      <tc:validateFileItem contentType="image/*"/>
-    </tc:file>
-
-    <tc:flowLayout>
-      <tc:style textAlign="right"/>
-      <tc:button label="Submit" defaultCommand="true" action="#{upload.upload}"/>
-    </tc:flowLayout>
+    <tc:section label="Basics">
+
+      The first example loads up an arbitrary file. The second example contains a <code>&lt;tc:validateFileItem></code>
+      tag with restrict the content type.
+
+      <tc:file label="Upload file:" value="#{upload.file1}" tip="without extra validation" id="file1"/>
+
+      <tc:file label="Upload image:" value="#{upload.file2}" id="file2"
+               tip="with a validator for file items - types: gif, jpg, png">
+        <tc:validateFileItem contentType="image/*"/>
+      </tc:file>
+
+      <tc:flowLayout>
+        <tc:style textAlign="right"/>
+        <tc:button label="Submit" defaultCommand="true" action="#{upload.upload}"/>
+      </tc:flowLayout>
+    </tc:section>
+
+    <tc:section label="Tips">
+
+      <p>
+        To load up files to the server for JSF 2.0 and 2.1 you will need to
+        add an multipart-config entry to the FacesServlet in the <code>web.xml</code> file.
+        Since JSF 2.2 this is not required.
+      </p>
+
+      <p>
+        Here you can configure some more general information.
+      </p>
+
+    <pre><code class="language-markup">      &lt;multipart-config>
+      &lt;location>/tmp&lt;/location>
+      &lt;max-file-size>20848820&lt;/max-file-size>
+      &lt;max-request-size>418018841&lt;/max-request-size>
+      &lt;file-size-threshold>1048576&lt;/file-size-threshold>
+      &lt;/multipart-config></code></pre>
+
+      <p>
+        If using Servlet API 3.1 you may call <code>part.getSubmittedFileName()</code>,
+        for 3.0 you may use the Utility
+        <code>org.apache.myfaces.tobago.internal.util.PartUtils.getSubmittedFileName(part)</code>
+        to access to filename of the upload.
+      </p>
+    </tc:section>
 
     <tc:section label="AJAX">