Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to add ajax behavior to synamically created component?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using JSF 2.0.

I have a need to generate components in my backing beans and have them displayed on the page when rendered.
Creating the component is not an issue, I can do that with the code listed below.
However I want to add ajax functionality and I do not know how to do that in the backing bean.

A simple example of an ajax enabled component on an xhtml page would be something like:



To create something similar in a backing bean I use the following code in my backing bean:



I then add this as a child of a component on the page.

What I don't know how do do is add the ajax behavior to this compponent.

Does anyone know how to do this?

Thanks.



 
Saloon Keeper
Posts: 25472
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your HtmCommandButton class should include attributes for each of the JavaScript properties that the control supports. So you'd have to attach the javaScript to the appropriate attribute (for example, "onclick", using button.setOnclick()).

The tricky part is that I believe that the actual value passed to that method has to be an EL expression object - you can't just attach the raw JavaScript text directly.
 
Burferd Grabarkowitz
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question still remains, how can that be done.
Could anyone give an example?
 
You guys haven't done this much, have ya? I suggest you study this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic