Bonsoir,
je travaille sur un projet web en java dans lequel j'utilise les technologies jsf 2.0 et primefaces 4.0 pour la présentation.
Mon souci est le suivant: j'ai 2 pages dont la 1ere (page1.xhtml) contient les infos que je souhaiterais transmettre à la 2e page (pas encore conçue ).
J'ai vu ce post qui est similaire à mon besoin (lien )mais je constate qu'il utilise un managed bean de type "session" ce qui signifie que ce bean restera en mémoire durant toute la durée de vie de la session et peut être on pourra être confronté aussi à un problème de "thread safe".
voici les codes sources de ma page1.xhtml:
Comment pourrais je faire pour transmettre la valeur "test" à la page2.xhtml de manière adéquate?
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 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:head> <f:facet name="last"> <h:outputStylesheet name="css/begin.css" /> <h:outputScript library="js" name="mapscript.js"/> </f:facet> </h:head><body> <h:panelGrid columns="1" cellpadding="5"> <p:commandButton value="Consulter" styleClass="ui-buttonok" style="margin-top:50px; margin-left:45px;" action="page2.xhtml" ajax="false" > <f:attribute name="attributeName1" value="test" /> </p:commandButton> </h:panelGrid> </body> </html>
Merci d'avance pour votre aide.
Partager