Merge branch 'historiqueEditeur' of grogv3.legrog.org:grogv3/web-application into historiqueEditeur
Showing
2 changed files
with
26 additions
and
12 deletions
... | @@ -7,17 +7,15 @@ import org.legrog.entities.User; | ... | @@ -7,17 +7,15 @@ import org.legrog.entities.User; |
7 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
8 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
9 | 9 | ||
10 | -import javax.enterprise.context.RequestScoped; | ||
11 | import javax.faces.view.ViewScoped; | 10 | import javax.faces.view.ViewScoped; |
12 | -import javax.faces.context.FacesContext; | ||
13 | import javax.inject.Inject; | 11 | import javax.inject.Inject; |
14 | import javax.inject.Named; | 12 | import javax.inject.Named; |
13 | +import java.io.Serializable; | ||
15 | import java.sql.Timestamp; | 14 | import java.sql.Timestamp; |
16 | -import java.util.Map; | ||
17 | 15 | ||
18 | @Named | 16 | @Named |
19 | @ViewScoped | 17 | @ViewScoped |
20 | -public class PublisherRevisionView { | 18 | +public class PublisherRevisionView implements Serializable { |
21 | Logger logger = LoggerFactory.getLogger(getClass()); | 19 | Logger logger = LoggerFactory.getLogger(getClass()); |
22 | 20 | ||
23 | @Inject | 21 | @Inject |
... | @@ -40,11 +38,18 @@ public class PublisherRevisionView { | ... | @@ -40,11 +38,18 @@ public class PublisherRevisionView { |
40 | private Timestamp publisherRevisionDatetime; | 38 | private Timestamp publisherRevisionDatetime; |
41 | 39 | ||
42 | public void loadData() { | 40 | public void loadData() { |
43 | - Map<String,String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); | 41 | + logger.debug("publisherRevisionId = {}", this.publisherRevisionId); |
44 | 42 | ||
45 | - PublisherRevision publisherRevision = publisherRevisionService.getPublisherRevision(new Integer(params.get("publisherRevisionId"))); | 43 | + PublisherRevision publisherRevision = publisherRevisionService.getPublisherRevision(publisherRevisionId); |
46 | - setPublisherRevisionId(publisherRevision.getPublisherRevisionId()); | 44 | + |
47 | - logger.info("publisherRevisionId = " + getPublisherRevisionId()); | 45 | + logger.debug("Found a publisher revision : {}", publisherRevision.toString()); |
46 | + | ||
47 | + | ||
48 | +// Map<String,String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); | ||
49 | +// | ||
50 | +// PublisherRevision publisherRevision = publisherRevisionService.getPublisherRevision(new Integer(params.get("publisherRevisionId"))); | ||
51 | +// setPublisherRevisionId(publisherRevision.getPublisherRevisionId()); | ||
52 | +// logger.info("publisherRevisionId = " + getPublisherRevisionId()); | ||
48 | } | 53 | } |
49 | 54 | ||
50 | public int getPublisherRevisionId() { | 55 | public int getPublisherRevisionId() { | ... | ... |
... | @@ -4,14 +4,23 @@ | ... | @@ -4,14 +4,23 @@ |
4 | <html xmlns="http://www.w3.org/1999/xhtml" | 4 | <html xmlns="http://www.w3.org/1999/xhtml" |
5 | xmlns:h="http://xmlns.jcp.org/jsf/html" | 5 | xmlns:h="http://xmlns.jcp.org/jsf/html" |
6 | xmlns:ui="http://xmlns.jcp.org/jsf/facelets" | 6 | xmlns:ui="http://xmlns.jcp.org/jsf/facelets" |
7 | - xmlns:f="http://xmlns.jcp.org/jsf/core"> | 7 | + xmlns:f="http://xmlns.jcp.org/jsf/core" |
8 | + xmlns:jsf="http://xmlns.jcp.org/jsf" | ||
9 | + > | ||
10 | +<head> | ||
8 | <f:metadata> | 11 | <f:metadata> |
9 | <f:viewParam name="publisherRevisionId" value="#{publisherRevisionView.publisherRevisionId}" /> | 12 | <f:viewParam name="publisherRevisionId" value="#{publisherRevisionView.publisherRevisionId}" /> |
10 | - <f:event type="preRenderView" listener="#{publisherRevisionView.loadData}" /> | 13 | + <f:viewAction action="#{publisherRevisionView.loadData}" /> |
11 | </f:metadata> | 14 | </f:metadata> |
15 | +</head> | ||
12 | <body> | 16 | <body> |
13 | -<p>Depuis le paramètre : <h:outputText value="#{param['publisherRevisionId']}" /></p> | 17 | + |
14 | -<p>En passant par la vue : <h:outputText value="#{publisherRevisionView.publisherRevisionId}" /></p> | 18 | +<p>Depuis le paramètre : #{param['publisherRevisionId']} </p> |
19 | +<p>En passant par la vue : #{publisherRevisionView.publisherRevisionId} </p> | ||
20 | + | ||
21 | +<form action="" jsf:id="reload-form"> | ||
22 | + <button jsf:id="reload" jsf:action="#{publisherRevisionView.loadData}">Reload !</button> | ||
23 | +</form> | ||
15 | 24 | ||
16 | </body> | 25 | </body> |
17 | </html> | 26 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment