• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

h:commandLink selected value

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


I get links in the loop. Can I get selected value on click by one of this links and pass it to popup or to a bean or to anywhere? I tried to pass the #{log.amount} value through onclick attribute, but only last value of received links is passed. Could you help me?
 
Saloon Keeper
Posts: 27882
197
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
Welcome to the JavaRanch, Dmitry!

This is one of the reasons why I recommend using the h:dataTable instead of ui:repeat. dataTables have a corresponding DataModel object that contains that sort of information. a4j:repeat is a lot like ui:repeat, except that it allows limiting the data submitted on the AJAX request to just the current iteration's elements.

Unfortunately, the RichFaces docs are woefully inadequate on what's what. For example, they list the "value" as being "The current value for this component." and of type java.lang.Object. I doubt it. It's almost certainly got to be an iterable object - either an array or a Collection, not just any old object.

I suspect that the "ajaxKeys" attribute is what you need, but they don't give a sensible explanation of how it works.

One reason I'm not more familiar with this particular tag is that I use the dataTable. Instead of an h:commandLink, I use the a4j:commandLink with an ajaxSingle="true" set to limit the submit to not merely the current row, but to the single element that's of interest: the link itself. In the commandLink's action method, I call the getRowData() method on the dataTable (model), which would then provide me with the information I needed as to which log file to display.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic