0

Whenever I try to execute some JavaScript code on my XHTML JSF pages I get the following error:

Caused by: javax.el.PropertyNotWritableException: Illegal Syntax for Set Operation

<h:commandButton onclick="addTest()" styleClass="btn-primary" value="Add Test"></h:commandButton>

<div class="labTest"></div>

<script type="text/javascript">
function addTest()
{ 
 $(document).ready(function(){
     $(".labTest").html("<b>Hello world!</b>");
 });
}
</script>

Now I am trying to populate the .labTest div with some html code. Any help will be appreciated.

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
  • I have $(".labTest").html("Hello world!"); and not $("#labTest").html("Hello world!"); – user3035404 May 16 '17 at 09:48
  • Hi Jasper. I am very new to JSF. I have always written code in PHP for web apps and Java for desktop apps or web back end. Now I am trying to use JSF and I have that error. Kindly advise how I should edit the question. – user3035404 May 16 '17 at 10:40
  • Thanks a lot Jasper. I had an input field as follows: I think it was making an attempt to map value=" " to a bean property. Following the link you gave me opened my mind. – user3035404 May 16 '17 at 12:59
  • 1
    Possible duplicate of [javax.el.PropertyNotWritableException: /Supprimer.xhtml @14,44 value="": Illegal Syntax for Set Operation](http://stackoverflow.com/questions/13714081/javax-el-propertynotwritableexception-supprimer-xhtml-14-44-value-illegal) – Kukeltje May 16 '17 at 13:07
  • 1
    Next time please post the full stacktrace (contains valuable information, see the 'duplicate') – Kukeltje May 16 '17 at 13:09
  • Noted with thanks. – user3035404 May 16 '17 at 14:16

0 Answers0