0

I have a command button:

<h:commandButton value="button" action="#{bean.button}" />

I need to perform a redirection after the action ends.

What I do is to return a string with the page name.

The outcome is the desired page but the URL is of the previous page.

How can I fix that?

Aritz
  • 30,971
  • 16
  • 136
  • 217
user1692261
  • 1,197
  • 3
  • 16
  • 30

1 Answers1

0

In order to update browser's url, you need to tell jsf to perform a redirect. Basically you need to append ?faces-redirect=true to your outcome value.

Aritz
  • 30,971
  • 16
  • 136
  • 217
  • if that bean is @RequestScoped would this redirecion will erase its content? if so, how could I perform a redirect + execute some action with a button. thanks a lot – user1692261 Feb 25 '13 at 18:46
  • If the bean is `@RequestScoped` the content is erased. If you want to perform some action, it's enough to put it into the action backing method logic, isn't it? – Aritz Feb 25 '13 at 19:32
  • I don't understand what you mean. see this: http://stackoverflow.com/questions/15074911/jsf-execute-action-on-some-input-and-then-href and if you can answer there it would be great – user1692261 Feb 25 '13 at 19:37