Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

DataTable row selection

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I have a simple problem but I'm a beginner in JSF so I couldn't solve it.
I have a DataTable with a link (or a button) on each row. If the user clicks on it, I would like to show the details of the selected row on an other page.

My problem is I can't pass the id of the row to an action. Actually I don't know how to do that, or what is the good solution.

I know it must be a very basic problem, but I didn't find any examples or tutorials which show how to do this particular thing.


Thanks in advance,
Peter
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey peter

take a look in this thread

https://coderanch.com/t/213290/JSF/java/Why-JSF-calls-method-parameter

This example shows exactly how you can pass the rowIndex or whatever you want to you action/actionListener method
 
Peter Braun
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help!

Recently have I found some good example related to table row selection in this book:
JavaServer Faces By Hans Bergsten: Chapter 10 / Processing Row-Specific Events
http://www.oreilly.com/catalog/jsvrfaces/toc.html

It helped me, so I thought it's worth considering.

Thanks again.
Peter
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to do something similar to the original poster. How would you apply the information in Leonardo's response to get the original poster's intended results?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic