Let's assume we got simple page that accepts one parameter:
<f:viewParam name="name" value="#{bean.name}"/>
When user goes to http://localhost/myapp/?name=Joe
, then #{bean.name}
is set to Joe
.
Then if user goes to http://localhost/myapp/
or http://localhost/myapp/?something=Else
, then #{bean.name}
is still set to Joe
, but I want it to be null
. How this can be done?
Use the right managed bean scope for the data it holds. You've apparently put it in the session scope. Put the bean holding the parameter in the request or view scope instead of session scope and when using view scope, make sure that you navigate by a normal link or by a post-redirect-get when performing an action.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With