salut tout le monde,
j'ai mit en place n h:commandLink me permettant de faire appel a une fenetre du navigateur qui me propose d'enregistrer ou d'ouvrir un fichier
Ca marche sans probleme cependant apres lorsque j'utilise un bouton present dans la meme fenetre, ce dernier m'impose la meme action que le h:commandLinkalors q'une action est deja définie pour ce bouton
Auriez vous une idée sur l'origine du probleme ?
Mon commandLink:
ma methode pour le fichier:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 <h:commandLink action="#{beanController.openFichier}" immediate="true" rendered="#{!creation}"> <h:graphicImage id="#{tableName}-img-view" alt="view" url="/images/i-view.gif" styleClass="image" /> <f:param name="idfichier" value="#{fichier.idfichier}" /> </h:commandLink>
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 ....................... //Lecture des informations du fichier Fichier fichier = publicFacade.fichierFindByPrimaryKey(new Integer( idfichier)); HttpServletResponse response= (HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse(); response.setContentType(fichier.getContentType()); response.setHeader("Content-Disposition", "attachment; fileName=" + fichier.getDesignation() + ""); OutputStream out; try { out = response.getOutputStream(); out.write(fichier.getFichier()); out.flush(); out.close(); } catch (IOException e){ logger.error(e.getMessage()); e.getCause().printStackTrace(); }
Partager