JR Utily
Committed by Jean-Francois Leveque

fix le load (et reload) des revisions (acces via GET parameters)

......@@ -7,17 +7,15 @@ import org.legrog.entities.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.enterprise.context.RequestScoped;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Map;
@Named
@ViewScoped
public class PublisherRevisionView {
public class PublisherRevisionView implements Serializable {
Logger logger = LoggerFactory.getLogger(getClass());
@Inject
......@@ -40,11 +38,18 @@ public class PublisherRevisionView {
private Timestamp publisherRevisionDatetime;
public void loadData() {
Map<String,String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
logger.debug("publisherRevisionId = {}", this.publisherRevisionId);
PublisherRevision publisherRevision = publisherRevisionService.getPublisherRevision(new Integer(params.get("publisherRevisionId")));
setPublisherRevisionId(publisherRevision.getPublisherRevisionId());
logger.info("publisherRevisionId = " + getPublisherRevisionId());
PublisherRevision publisherRevision = publisherRevisionService.getPublisherRevision(publisherRevisionId);
logger.debug("Found a publisher revision : {}", publisherRevision.toString());
// Map<String,String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
//
// PublisherRevision publisherRevision = publisherRevisionService.getPublisherRevision(new Integer(params.get("publisherRevisionId")));
// setPublisherRevisionId(publisherRevision.getPublisherRevisionId());
// logger.info("publisherRevisionId = " + getPublisherRevisionId());
}
public int getPublisherRevisionId() {
......
......@@ -4,14 +4,23 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:jsf="http://xmlns.jcp.org/jsf"
>
<head>
<f:metadata>
<f:viewParam name="publisherRevisionId" value="#{publisherRevisionView.publisherRevisionId}" />
<f:event type="preRenderView" listener="#{publisherRevisionView.loadData}" />
<f:viewAction action="#{publisherRevisionView.loadData}" />
</f:metadata>
</head>
<body>
<p>Depuis le paramètre : <h:outputText value="#{param['publisherRevisionId']}" /></p>
<p>En passant par la vue : <h:outputText value="#{publisherRevisionView.publisherRevisionId}" /></p>
<p>Depuis le paramètre : #{param['publisherRevisionId']} </p>
<p>En passant par la vue : #{publisherRevisionView.publisherRevisionId} </p>
<form action="" jsf:id="reload-form">
<button jsf:id="reload" jsf:action="#{publisherRevisionView.loadData}">Reload !</button>
</form>
</body>
</html>
\ No newline at end of file
......