This question already has answers here:
ViewParam vs #ManagedProperty(value = "#{param.id}")
(2 answers)
Closed 8 years ago.
At what point is a field using #ManagedProperty annotation set?
Specifically, does it happen during construction or after construction?
Any field using #ManagedProperty annotation is set immediately after the constructor runs. So the same field can be used in a #PostConstruct method. That is what my main concern was while asking this question. For more lucid details please refer to the following excellent post https://stackoverflow.com/a/4889226/1391249
Related
This question already has an answer here:
How can I access session attribute in Facelets page
(1 answer)
Closed 5 years ago.
I am trying to write some code in jsf scriptlet to get a attribute from HttpSession and compare with a UI value (to display a pop-up when both session and UI values are same ) .
You can do it in JSF with EL: #{session.getAttribute('key') eq uiValue}.
List of all JSF EL objects can be found here.
This question already has answers here:
Integrating JSTL With Facelets
(2 answers)
Internationalization in JSF, when to use message-bundle and resource-bundle?
(1 answer)
Localization in JSF, how to remember selected locale per session instead of per request/view
(5 answers)
JSTL in JSF2 Facelets... makes sense?
(3 answers)
Closed 5 years ago.
I tried to use jsf .properites bundle, but it does not work in my case.
<fmt:setLocale value="ru"/>
<fmt:setBundle basename="text"/>
<fmt:message key="test"/>
Message not showing.
In application server log no any related messages.
text.properties and text_ru.properties content:
test = 123
My project structure:
This question already has answers here:
Clear JSF form input values after submitting
(5 answers)
Closed 5 years ago.
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!!
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.
if u are using
#SessionScoped
Try to change to :
#ViewScoped
This question already has answers here:
Conditionally displaying JSF components
(3 answers)
Closed 6 years ago.
I wanna add this action.
If EL is 'true' like this, #{trueFalseBean.isTrue}, I wanna pop up message without pressing any button like 'onload();', otherwise no action. How can I use if, else clause on JSF or PF? Please help me thanks
Define a boolean variable in your bean and set it with a method when an action is started. Then use variable last situation to make something.
This question already has an answer here:
Which properties in a JSF backing bean can be set by a user?
(1 answer)
Closed 8 years ago.
I'm asking if the Bean (Sessionscoped, ManagedBean) is secure enough to save a variable "isAdmin = true". The user must not have a chance to change this value!
So the main question is: does the user has access to the beans (when there are no getters/setters and components on the view)?
Yes, it should be secure because it's a server side component so user have no access to it's fields except the one you make visible for him.