• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF commandLink to Display a Specific Row of Data in a new JSF Page  RSS feed

 
Oli Brown
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I am currently working on a project where I have a dataTable, containing some of the information for a specific database table, with commandLinks at the side which I need to bring me to a new page(another jsf file that I have to display the relevant information there) and display only the row of data selected. I've been racking my brain about this and have been unable to figure out a way to do it. Any pointers?
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Oli!

This is a common thing - although please don't open the detail view in a new window/pane. I have enough junk on my desktop already.

Check out the "JSF for Non-Believers" series at IBM developerworks. It's pretty old now, but about the only real difference between then and now is that now you can define Managed Beans and Managed Properties as java source code annotations instead of only in the faces-config.xml file (if you do it both ways, faces-config overrides the java annotations).
 
Oli Brown
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The goal is to just switch to that new page. Is there a particular area of that IBM thing I should be looking at?
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSF term for "switch to a new page" is called "navigation". When an action method is invoked from an commandButton or commandLink, the action method is expected to return a string or null. If it returns null, the same view (page) is re-displayed. If something else is returned, then it's considered to be either the logical identifier of a view (defined in faces-config.xml) or (JSF2) the actual URL location of a view. Thus you would be return the id of a details view to JSF so that it could navigate there.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!