0

in JSF page I the following code:

<h:dataTablevalue="#{rulesCntrl.getTblStati()}" var="stato"
  rendered="rdrGroupTable(
  #{rule.actuatorModule.model.type},
  #{rule.funzione.chiave})">

where type and chiave are two integer. I wold like to pass these numbers to the following javascript function:

<script type='text/javascript'>
  function rdrGroupTable(moduleType, ruleFunction) {
    if((moduleType === 97) && (ruleFunction === 1)){
      return true;
    }
    return false;
  }
</script>

but I get the message: Error Traced [line: 24] The entity name must immediately follow '&' in the entity reference.

Some help, please? Domenico

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
  • Stefan, currently the solution is the one you suggested but the purpose of the new version (client side) is to reduce network traffic and above all to speed up the response. Thanks for the contribution – Domenico Formenton May 09 '19 at 08:19
  • 1
    Reduce network traffic by using ajax and partial submit. Moving things pure client-side introduces security risks and makes the application more complex. – Kukeltje May 09 '19 at 08:26
  • Btw, rendered is an attibute which is evaluated at server side, when the HTML gets rendered. You can't use any javascript at this point. – Holger May 09 '19 at 12:41

1 Answers1

1

I suggest you put the logic in your bean. In JSF page:

... rendered="#{rulesCntrl.isRdrGroupTable(rule.actuatorModule.model.type, rule.funzione.chiave)}" ...

In RulesCntrl.java:

public boolean isRdrGroupTable(int type, int chiave) {
    return moduleType === 97 && ruleFunction === 1;
}
Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
Stefan
  • 2,395
  • 4
  • 15
  • 32