How to get HttpSession attributes from jsf web page [duplicate] - jsf

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.

Related

How to get id from request/response in JSF? [duplicate]

This question already has answers here:
How to find out client ID of component for ajax update/render? Cannot find component with expression "foo" referenced from "bar"
(6 answers)
Closed 4 years ago.
I have such id of dialog form form:processFilterPanel_fpanel_tv:dialogFormIO:j_idt195:ItemWidget_input
And I want to work with one element of form at backend side. The problem that this part of id j_idt195 is always changing by jsf (when it starts a new session) and I don't know how to get it. Have any ideas?
Just use id="yourFavId" on the component and reference it.
JSF gives those weird looking ids to the html components that didn't have a defined one.

how to correct use .properties bundle? [duplicate]

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:

How can I add 'if condition' in primefaces, jsf [duplicate]

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.

jsf 2.0 is backing session bean secure? [duplicate]

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.

JSF Back Button [duplicate]

This question already has answers here:
back commandbutton in jsf
(5 answers)
Closed 8 years ago.
How do I make a link which navigates the user back one page (i.e. same as clicking browser back)?
Thanks.
To the point: just remember the request URL or the JSF viewId of the previous page so that you can use it in the href or value of the output/commandlink. There are several ways to achieve it, depending on how you're actually navigating through the pages and how "jsfish" you want to achieve it. You could pass it as a request parameter by f:param in h:outputLink, or you could set it as a bean property by f:setPropertyActionListener in h:commandLink, or you could create a PhaseListener which remembers the viewId and make use of navigation cases, or you could grab the -much less reliable- JavaScript history.go() function.

Resources