• 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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

 
Greenhorn
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?
 
Bartender
Posts: 20125
103
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 mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!