Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3848952
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:46:47+00:00 2026-05-19T16:46:47+00:00

I have a page with a data table. I want some of the items

  • 0

I have a page with a data table. I want some of the items in the tables to be linked to a corresponding view page.

For example, right now I have a table with no links:

<h:dataTable var="bean" value="#{beanServiceImpl.beans}" border="1">
    <h:column>#{bean.id}</h:column>
  </h:dataTable>

I want to add hyperlinks to some entries and have them go to a view page showing them more info based on their id:

  <h:dataTable var="bean" value="#{beanServiceImpl.beans}" border="1">
    <h:column>
        <a href="viewBean.xhtml?id=#{bean.id}">#{bean.id}</a>
    </h:column>
  </h:dataTable>

ViewBean.xhtml will contain something like this:

ViewBean.xhtml

<ul>
  <li>ID: #{bean.id}</li>
  <li>Field 1: #{bean.field1}</li>
  <li>Field 2: #{bean.field2}</li>
</ul>

How do I accomplish something like this in JSF? I know that I’ll have to write a controller to query the id for the other fields. But how do I make viewBean.xhtml run the business logic to get the other fields and render it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T16:46:47+00:00Added an answer on May 19, 2026 at 4:46 pm

    The BalusC’s answer is almost good, but will not work (edit: it works now).

    You already know, how to add the value to the params. BTW, if I were you, I would not use <a href>, but instead:

    <h:link outcome='viewBean'>
        <f:param name='id' value='#{bean.id}' />
    </h:link>
    

    Now you have to choices when it comes to catching the value. The simplest would be to add annotation above your id property:

    @ManagedProperty("#{param.id}") // this will inject id from param into id
    private Long id;
    
    
    //  (getters and setters are obligatory)
    
    
    @PostConstruct // this will execute init() after id is injected
    public void init() {
    
    }
    

    And the last thing: having a variable named “bean” has no more sense than calling it “variable” (or having a dog named Dog and cat named Cat). It carries no information and worse, it makes all the beans in your application indistinguishable (unless you build a legumes manager).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried to find a table with class data in a web page
When showing data from a mysql table on an php page does it have
I have a table full of items from different sources. Some of the sources
I have an application that shows some data in p:DataTable.... This table is accessible
I have a page which has a long grid/table data...I am testing it on
So I have some data in MySQL being shown on my PHP page inside
I'm working on a web page where I have some data visualized in html
I have data in a table in following manner tablename : history page_url verified
I have a JSP page retrieving data and when single or double quotes are
I have very very big html page/data. I need to fetch data under h1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.