Note that there are some explanatory texts on larger screens.

plurals
  1. POWhich properties in a JSF backing bean can be set by a user?
    primarykey
    data
    text
    <p>I have a backing bean (<code>somebean</code>) with three boolean properties <code>a</code>, <code>b</code>, and <code>c</code>, each has a getter and setter.</p> <p>I have a form which looks like this:</p> <pre><code>&lt;h:outputText rendered="#{somebean.b}"&gt; B is true &lt;/h:outputText&gt; &lt;h:form id="blah"&gt; &lt;h:inputHidden value="#{somebean.a}" id="a"/&gt; &lt;h:commandLink id="zzzz" value="do it" action="#{somebean.doIt}"/&gt; &lt;/h:form&gt; </code></pre> <p>Which of the three properties <code>a</code>, <code>b</code>, and <code>c</code> can be set by the client? I tried adding <code>b=true</code> and <code>c=true</code> to the POST request, but <code>SomeBean.setB(boolean)</code> and <code>SomeBean.setC(boolean)</code> never get called. So perhaps only <code>a</code> can be set - the logic being that if there is a field in the JSF that sets it, the client is allowed to set it. But perhaps I'm wrong and it just has some default name that I don't know about that can be used to set it...</p> <p>Should I just assume that any property on my bean can be set by the client? If not, which ones should I assume the client can set (and thus have to worry about during validation)?</p> <p>Also what happens if I have my form conditionally rendered? e.g:</p> <pre><code>&lt;h:outputText rendered="#{somebean.b}"&gt; &lt;h:form id="blah"&gt; &lt;h:inputHidden value="#{somebean.a}" id="a"/&gt; &lt;h:commandLink id="zzzz" value="do it" action="#{somebean.doIt}"/&gt; &lt;/h:form&gt; &lt;/h:outputText&gt; </code></pre> <p>In this case, can <code>a</code> still be set if <code>b</code> is false?</p> <hr> <p>By "client", I mean anything sending HTTP traffic to my site. Which could be for example, malicious code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload