Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You cannot use the conditional operator <code>?:</code> in value and action expressions. The value expression would throw a <code>PropertyNotWritableException</code> on form submit because the EL syntax does not represent a writable operation, instead it is a read-only operation. The action expression would already throw an <code>ELException: not a valid method expression</code> on page load because the EL syntax does not represent a method expression but a value expression. </p> <p>You need to solve it differently and then in such way that you can get rid of the conditional operator <code>?:</code> in the value and action expressions altogether. This can be achieved in several ways: </p> <ol> <li><p>Using an abstract base class and a tagfile. Currently, your backing bean method names are unfortunately not aligned out in such way that they are exactly the same on both classes. You've only <code>globalFilter</code> property aligned, but the action listener methods not. I suggest to rename them to <code>filter()</code> and <code>resetFilter()</code>. Then you can extract an abstract base class from those bean classes and use it on a <a href="https://stackoverflow.com/questions/6822000/when-to-use-uiinclude-tag-files-composite-components-and-or-custom-componen/6822269#6822269">custom tag file</a> like follows:</p> <pre class="lang-html prettyprint-override"><code>&lt;my:filter beanName="#{param.from eq 'TERMINAL' ? 'terminalsList' : 'merchantsList'}" /&gt; </code></pre> <p>which is implemented like follows (assuming that those beans are request scoped):</p> <pre class="lang-html prettyprint-override"><code>&lt;h:inputText value="#{requestScope[beanName].globalFilter}" size="50" /&gt; &lt;h:commandButton value="Filter" actionListener="#{requestScope[beanName].filter}" /&gt; &lt;h:commandButton value="Reset" actionListener="#{requestScope[beanName].resetFilter}" /&gt; </code></pre> <p><em>(if your bean is in a different scope, just change <code>#{requestScope}</code> accordingly, e.g. <code>#{viewScope}</code>)</em></p> <hr></li> <li><p>Using JSTL to conditionally build the view. This is really clumsy (not <a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself" rel="nofollow noreferrer">DRY</a>), but maybe easier for a starter and actually the only way if you can't change the method signatures for some unclear reason.</p> <pre class="lang-html prettyprint-override"><code>&lt;c:choose&gt; &lt;c:when test="#{param.from eq 'TERMINAL'}"&gt; &lt;h:inputText value="#{terminalsList.globalFilter}" size="50" /&gt; &lt;h:commandButton value="Filter" actionListener="#{terminalsList.filterTerminals}" /&gt; &lt;h:commandButton value="Reset" actionListener="#{terminalsList.resetTerminalsFilter}" /&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;h:inputText value="#{merchantsList.globalFilter}" size="50" /&gt; &lt;h:commandButton value="Filter" actionListener="#{merchantsList.filterMerchants}" /&gt; &lt;h:commandButton value="Reset" actionListener="#{merchantsList.resetMerchantsFilter}" /&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; </code></pre></li> </ol>
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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