1 Reply Latest reply: Aug 30, 2013 12:42 AM by Nitish_Potti RSS

    Retaining page state when navigating back from commandButton

    ankurmdh

      Hi All,

       

      JDev Version: 11.1.1.6.0

       

      We have a taskflow, with 3 jsff page. One 1 page, we have a table on which can search and filter the table result.  Now from 1 page, we can navigate to 2 page which is detail page of particular table column.

       

      On 2 page, we have command button which open page 3 to send an email. Once Email is sent successfully, we show a confirmation popup with OK button, which redirect back to page 1.

      From 1 page also we can send email, which redirect to 3 page, and once email is sent successfully we show same confirmation popup with OK button, which redirect back to page 1.

       

      Issue is, if we do some search in Page 1 or filter the table. And then perform  Email functionality from either page (1 or 2) , clicking on OK button is redirecting to page 1, but the search criteria/filter is lost and page 1 load with default result.

       

      We want search/filter should retain it state once we redirect from OK button from page 3.

       

      Code:

       

      <af:commandButton text="#{OK}" id="cb5" immediate="true"

                          actionListener="#{pageFlowScope.emailPatchBean.goToPage}" blocking="true"></af:commandButton>

       

       

          public void goToPage(ActionEvent actionEvent) {

                         FacesContext context = FacesContext.getCurrentInstance();

                 ExternalContext externalContext = context.getExternalContext();

                 HttpServletRequest req = (HttpServletRequest)context.getExternalContext().getRequest();

                 String protocol = req.isSecure() ? "https" : "http";

                 String downloadURL =

                     protocol + "://" + req.getServerName() + ":" + req.getServerPort() + "" + req.getContextPath() +

                     "/faces/downloads";

       

       

                 try {

                     externalContext.redirect(downloadURL);

                 } catch (IOException e) {

                     logger.info("Redirection failed " + e.getMessage(), e);

                 }

           

          }

       

      Thanks,

      AP