alors bonjour tout le monde
alors je veux utiliser les inputFileUpload avec les jsf
je suiver ces itape mais je ne c pas pourquoit sa marche pas avec le button qui recupaire la chemains de inputFileUpload
voila ma page html :
et dans le bean ,jai mais sa pour voir c sa marche ou pas :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page contentType="text/html;charset=windows-1252"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%> <f:view> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/> <title>tester</title> </head> <body><h:form id="form1" > <t:inputFileUpload id="myUploadedFile" storage="file" accept="image/*" styleClass="myStyle" value="#{backing_tester.myUploadedFile}"/> <h:commandButton value="commandButton1" binding="#{backing_tester.commandButton1}" id="commandButton1" action="#{backing_tester.commandButton1_action}"/> </h:form></body> </html> </f:view> <%-- oracle-jdev-comment:auto-binding-backing-bean-name:backing_tester--%>
on plus de ca j'ai ajouter les filter dans le fichier web.xml et le jar dans le lib
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 package mypackage.backing; import javax.faces.component.html.HtmlCommandButton; import javax.faces.component.html.HtmlForm; import org.apache.myfaces.custom.fileupload.UploadedFile; public class Tester { private HtmlForm form1; private UploadedFile myUploadedFile; private HtmlCommandButton commandButton1; public void setForm1(HtmlForm form1) { this.form1 = form1; } public HtmlForm getForm1() { return form1; } public UploadedFile getMyUploadedFile() { return myUploadedFile; } public void setMyUploadedFile(UploadedFile myUploadedFile) { this.myUploadedFile = myUploadedFile; } public void setCommandButton1(HtmlCommandButton commandButton1) { this.commandButton1 = commandButton1; } public HtmlCommandButton getCommandButton1() { return commandButton1; } public String commandButton1_action() { // Add event code here... String aa=myUploadedFile.getName(); System.out.println("le Chemain de fichiers est "+aa); return null; } }
mais quant je clique dans le button il me return page introuvale
et naffiche mas le chemains
esque quelqu'un paut mider , et me donné une vois
mon bute dans tu ca c de pouvoir telecharger un zip d'un clien a un serveur avec les jsf
et merci
Partager