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 9055483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:57:51+00:00 2026-06-16T13:57:51+00:00

I am using JSF 2.0 and I have a datatable which gets populated using

  • 0

I am using JSF 2.0 and I have a datatable which gets populated using lazy load.Scope of the page is @ViewAccessScoped (MyFaces CODI) as I am using CDI/Spring.

When datatable is loaded in jsf page and when I select a row for the first time (radiobutton), I am not able to get selected row, for subsequent selections I am able to get selected row in onRowSelect method of ManagedBean. If I use session scope then I am able to get the selected row when I select row for the first time.

JSF Code

<p:dataTable id="dataTable" var="req" lazy="true" value="#{emp.lazyModel}"
      rowKey="#{req.empNo}"
         paginator="true" rows="10"
         selection="#{emp.selectedRequest}">                  
      <p:ajax event="rowSelectRadio" listener="#{emp.onRowSelect}" /> 
       <p:column selectionMode="single" style="width:18px" />  

ManagedBean

@Named("emp")
@ViewAccessScoped
public class EmployeeManagedBean implements Serializable {

private Employee selectedRequest = new Employee();

@PostConstruct
   public void init() {
      initTable();
   }

   private void initTable() {
      lazyModel = new LazyEmployeeDataModel(requestList, requestService);
   }

   public LazyDataModel<Employee> getLazyModel() {
      return lazyModel;

   }

and onRowSelect Method

public void onRowSelect(SelectEvent event) {
      try {
         setSelectedRequest((Employee) event.getObject());
         System.out.println("row "
               + getSelectedRequest()); 
  • 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-06-16T13:57:52+00:00Added an answer on June 16, 2026 at 1:57 pm

    I have resolved this issue, the problem was cookies.

    When list.jsf gets loaded for the first time, cookies was not set. So when user selects a row cookies gets set and thus for subsequent selections user could get selected row value.

    To resolve this issue, I have created a index.jsp page and redirect to list.jsf, thus cookies get set before user selects a row using radio button.

    Thanks

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

Sidebar

Related Questions

(Using jsf-2) I have a dataTable with one column which can be edited: <h:column>
I have created a page using JSF 2.0. Below is what I have <h:dataTable
I'm using JSF 1.1. I have a JSP page with a .... <t:dataTable id=data
I am using JSF 2.0 and Primefaces 3.4.2, I have a datatable populated using
I'm using JSF 2.0. I have a managed bean which I can access through
I have a small web application developed using Icefaces 1.8.2 and jsf 1.1 which
I am using a ace:datatable (in my jsf project). Inside this table I have
I am using JSF 2.1.7 and Myfaces CODI 1.0.5 on JBoss AS 7.1.1. My
I have developed web applications using JSF (myfaces components). But in these days of
I have a page with datatable with product information from which at a product

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.