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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:58:37+00:00 2026-05-23T09:58:37+00:00

When a commandLink is clicked, a new row should be added in the DataTable.

  • 0

When a commandLink is clicked, a new row should be added in the DataTable.
The data entered in the previous row is being cleared when the link is clicked.

I added <f:ajax event="click" render="@form" listener="bean.method"/> for <h:commandLink>.
What is the solution for this problem.

  • 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-23T09:58:38+00:00Added an answer on May 23, 2026 at 9:58 am

    The bean is apparently request scoped and is apparently not saving the data of the previous row so that it can be preloaded in the bean’s constructor of the next request.

    Putting the bean in a bit broader scope should fix this problem. I’d recommend putting the bean in the view scope. This way the bean will live as long as you’re returning void or null in action methods.

    @ManagedBean
    @ViewScoped
    public class Bean implements Serializable {
    
        // ...
    
    }
    

    See also:

    • How to Dynamically add a row in a table in JSF?
    • Recommended JSF 2.0 CRUD frameworks
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want a commandlink to be executed when the row is clicked in my
Here is a minimal rich:dataTable example with an a4j:commandLink inside. When clicked, it sends
Let's say we have a simple table defined as: <p:dataTable value=#{testBean.dummyStringData} var=data> <p:column> <p:commandLink
I have a h:commandLink inside rich:dataTable . When I click on the command link,
<h:commandLink id=#{id} value=#{value} action=#{actionBean.getAction} onclick=alert(this);/> In the previous simplified example, the 'this' keyword used
If you have a JSF <h:commandLink> (which uses the onclick event of an <a>
Here is how my commandLink work <p:dataTable value=#{myBean.users} var=item> <p:column> <h:commandLink value=#{item.name} action=#{myBean.setSelectedUser(item)} />
<h:form prependId=false> <p:dialog modal=true> <p:commandLink ajax=true value=ok actionListener=Bean.listenerMethod/> </p:dialog> </h:form> I had some other
I have a h:commandLink in one of the column in datatable. JSF <h:commandLink id=save
When I use the following command link: <h:commandLink action=student value=students /> And the following

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.