|
JSF Tags: Tomahawk Tags |
|
Rendered Output:
2.Tomahawk inputFileUpload tag :
File uploading is the concept of uploading
the file to the server. In Tomahawk, the
component for this purpose can be created
using <t:inputFileUpload> tag. Do
remember to include “enctype” attribute
in the form tag and set to “multipart/
form-data”. You must enable the MultiPart
Filter to make the component work. For
this, you have to add the code below in the
web.xml file.
<filter>
<filter-name>extensionsFilter
</filter-name>
<filter-class>
org.apache.myfaces.webapp.
filter.ExtensionsFilter
</filter-class>
<init-param>
<description>Set the size limit for
uploaded files.
Format: 10 - 10 bytes
10k - 10 KB |
|
10m - 10 MB
1g - 1 GB
</description>
<param-name>uploadMaxFileSize
</param-name>
<param-value>100m</param-value>
</init-param>
<init-param>
<description>Set the threshold size - files
below this limit are stored in memory, files
above this limit are stored on disk.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
</description>
<param-name>uploadThresholdSize
</param-name>
<param-value>100k</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>extensionsFilter
</filter-name>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>extensionsFilter
</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>
Code Description:
In the code below, inputFileUpload tag
creates the file upload component. We
have also created a button that when
clicked, causes a method upload() of the
backing bean(FileUploadForm.java) to
be called. In this code, the output text for
showing success and failure is rendered
based on the condition of success / failure
in uploading the file. For this, rendered
attribute has been used. |
|
Sept 2007 | Java Jazz Up |14 |
|
|
|
Pages:
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53 ,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63 ,
64,
65 ,
66 ,
67 ,
68 ,
69 ,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79, Download PDF |
|
|
|
|
|
|
|
|
|