I'm developing a project using JSF and Primefaces and I got some forms. Every time I open those forms all fields are already filled with the last information I saved on database. I'd like every time I open those forms all fields were blank. How can I do this? Thank you!!
Asked
Active
Viewed 117 times
0
-
2don't initialize the controller data from the database in postconstruct / constructor just persist the data on submission. if you add the facelet and the controller source we could help more in a more customized way. – The Bitman May 11 '17 at 14:42
-
Please provide a [mcve] – Jasper de Vries May 12 '17 at 17:55
-
please can u share ur managedBean ? – Rodik May 16 '17 at 08:46
2 Answers
1
What Scope are you using in your managed bean? if you are using session scope for example it will hold the last values of your bean properties as long as the application session exists. Depending on what you doing, I would use request scope instead. This will delete the bean when it is not being use and therefore clear the values when you request again. Or perhaps view scope, this will keep the values as long as you are in the same view. Another way would be to use javascript to clear the values by Ids.

JediSal
- 65
- 4
-
You're right! I was using session scope. I already fixed it and for a while it's correct. Thanks mate. – Paulo Henrique Dutra May 16 '17 at 13:27