0

I working with JSF 2.1 and primefaces 6.0. I have a commandButton in page A like this:

<p:commandButton value="GO" action="#{indexBB.clickSearchButton}" />

In the backingbean function:

public String clickSearchButton() {
        DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
        FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("dateini", dateFormat.format(dateIni));
return "B?faces-redirect=true";
}

In page B I try to recover the values but the map is empty and the just created parameter is no longer there:

@PostConstruct
public void init() {
    Map<String,Object> parameterMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
    if(parameterMap.get("dateini") != null ){
        //assign the value
    }
}

How could I send a parameter from the backingbean and recover it correctly in next page? I have taken a look at some other answer here with no result, like for example:

How to add request parameter in jsf2?

I don't want to use a 'f:param' or something like that.

May someone help me? Thanks in advance.

Community
  • 1
  • 1
Jesus Schneider
  • 103
  • 1
  • 11

0 Answers0