• 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

JSF2.2 change h:commandbutton value on AJAX  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm using JSF 2.2 (to write a small dating site) and I try to change h:commandbutton on AJAX from "like" to "liked" and vise-versa based on DB value:

Unfortunately putting value that is programatically generated doesn't seem to work:

Element type "h:commandButton" must be followed by either attribute specifications, ">" or "/>".

Maybe I'm using the wrong components - what is the right way to do is?
Saloon Keeper
Posts: 20510
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Roman!

The Unified Expression Language (EL) used by JSF is not a programming language. You should not write method calls in it. Its primary purpose is to reference, not to do.

If this is a button that is going to be repeated on each row of an h:dataTable, there's a much different way you should code it. It it's supposed to be a single button on a page, I'm not quite sure, since some parts of your example don't seem to be what you'd use in relation to other parts.

Also, I'm not sure what this "a:id" attribute is, but for the ordinary xml "id" attribute cannot be given a computed value. It has to be hard-coded.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!