• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Passing JSF bean values to javascript function

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in JSF page I the following code:


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


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

Some help, please? Domenico
 
Bartender
Posts: 20842
125
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try

The ampersand ("&") character has magical meaning in XML and HTML and to avoid ambiguity when referencing it as a non-XML construct you must refer to it by its entity name "&" Note the terminating semicolon. Some browsers forgive when it's not included, but without that semicolon, the entity name is syntactically incorrect. You can avoid this also by placing the JavaScript code in a separate javascript-only file.

Also:


is not good practice. It should simply reference the bean property, not attempt to use logic to fetch it. Like so:


For best results, the tblStati property should be a JSF DataModel object.  You can simply use an array or collection there, but you lose functionality if you do.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!