I have a basic question about JSF ManagedBeans for which I can't find a answer.
Suppose I have a bean MyBean
with two methods method1
and method2
and a JSF page with a command link
<h:commandLink action="#{myBean.method1}">
</h:commandLink>
Is it possible for someone to analyse the source code of the page and call method2
instead of method1
?
No, this is not possible by design.
Technically the client can only tell the server "The user clicked a html element with a certain id". This event is then processed by JSF on the server-side, the component with the corresponding id is looked up and in this case the method "#{myBean.method1}" is executed. As you can see, the client can not[!] tell the server what to do with this event.
JSF 2.2 Spec - 3.4 Event and Listener Model
Caveat