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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:34:39+00:00 2026-06-16T05:34:39+00:00

I need to have inputTexts inside primefaces datatable when form is in editable mode.

  • 0

I need to have inputTexts inside primefaces datatable when form is in editable mode.

Everything works properly except form cleaning with immediate=”true” (without form validation). Then primefaces datatable behaves unpredictable. After filling in datatable with new data – it still stores old values.

Short example – to show differences between h:dataTable and p:dataTable – but it works the same way when there is only one of three tables from the example:
test.xhtml

<h:body>
    <h:form id="form">

        <p:dataTable var="v" value="#{test.list}" id="testTable">
            <p:column headerText="Test value">
                <p:inputText value="#{v}"/>
            </p:column>
        </p:dataTable>

        <h:dataTable var="v" value="#{test.list}" id="testTable1">
            <h:column>
            <f:facet name="header">
                <h:outputText value="Test value" />
            </f:facet>
                <p:inputText value="#{v}" />
            </h:column>
        </h:dataTable>

        <p:dataTable var="v" value="#{test.list}" id="testTable2">
            <p:column headerText="Test value">
                <h:outputText value="#{v}" />
            </p:column>
        </p:dataTable>

        <p:commandButton value="Clear" actionListener="#{test.clear()}" immediate="true" update=":form:testTable :form:testTable1 :form:testTable2"/>
        <p:commandButton value="Update" actionListener="#{test.update()}" update=":form:testTable :form:testTable1 :form:testTable2"/>
    </h:form>
</h:body>

And java:

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

@Named
@ViewScoped
public class Test implements Serializable {

    private static final long serialVersionUID = 1L;

    private List<String>            list;



    @PostConstruct
    private void init(){
        update();
    }

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }

    public void clear() {
        list = new ArrayList<String>();
    }

    public void update() {
        list = new ArrayList<String>();
        list.add("Item 1");
        list.add("Item 2");     
    }
}

In the example above I have 3 configurations:
1. p:dataTable with p:inputText
2. h:dataTable with p:inputText
3. p:dataTable with h:outputText

And 2 buttons: first clears data, second applies data

Workflow:

  1. Try to change data in inputTexts in p:dataTable and h:dataTable

  2. Clear data of list (arrayList of string) – click “clear” button (imagine that you click cancel on form because you don’t want to store data to database)

  3. Load new data – click “update” button (imagine that you are openning new form with new data)

Question:
Why p:dataTable with p:inputText still stores manually changed data, not the loaded ones?
Is there any way to force p:dataTable to behaving like h:dataTable in this case?

  • 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-16T05:34:41+00:00Added an answer on June 16, 2026 at 5:34 am

    The solution is: primefaces resetInput

    In my example it would be:

     <p:commandButton value="Clear" actionListener="#{test.clear()}" immediate="true"
              update=":form:testTable :form:testTable1 :form:testTable2"> 
        <p:resetInput target=":form:testTable" />
     </p:commandButton>
    

    EDIT:
    In some cases – if the above would not work – try the one from primefaces extensions:

    <pe:resetInput for=":form:testTable" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form inside a div with a transparent color. I'd need to
Can I add JSF components dynamically? I need to have a form with a
I have <h:inputText> on form and what I need is to execute some method
I have some JSF code that currently works (as shown below), and I need
So I have form with 1 fields that need to be required <h:form id=form>
I have a form that I need styled to have 2, 4, and 6
I need to have some masks in my input fields in my form. I
I have a form with a dataTable which has various columns having links and
I have jsf datatable populated from backing bean ArrayList. Now I need to compare
I need to make a column editable by default in a datatable. I do

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.