Pregunta

As far as I understand, in JSF 1.1 all GET requests resulted in a postback to the current view when it such a view existed. In JSF 1.2, this changed so that GET always created a new view, so that bookmarking worked. Is it still possible to stay in the current view using GET requests, that is, to have the behavior as it was in 1.1?

Example

  • GET welcome page, rendered from facelets welcome.xhtml file, containing <h:commandLink action="inventory">
  • click on the link for POST request of inventory.xhtml. Inventory shows, browser URL is still welcome
  • do page reload in browser. In JSF 1.1, inventory is redisplayed. In JSF 2.0, welcome page is displayed
  • I can add ?faces-redirect=true to the action to get a different URL for the inventory page, so that page reload redisplays the inventory
  • how can I get the behavior of JSF 1.1, that is, redisplay the inventory on GET welcome without doing a redirect?

Why I would like to do that: Don't expose internals of the webapp to browser URL, keep entire webapp under one URL, save request roundtrips, have smooth incremental page updates instead of complete page changes in browser

¿Fue útil?

Solución

I finally solved the requirement by having a single application view which dynamically includes the desired application page, selected by application view local state.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top