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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:38:07+00:00 2026-06-08T20:38:07+00:00

I’m having problems saving/updating rows within a table. I have a method myBean.addRule to

  • 0

I’m having problems saving/updating rows within a table.

I have a method myBean.addRule to dynamically add new rows to the table.
This seems to work ok….I click it and a new row appears in the UI to enter new data.

But problems seem to arise when I save myBean.saveRules.

It looks like only the most recently added row is getting bound to my backing beans and updated.

For example if I have 3 rows of data:

– remove some text from row 1 and hit the save button this update is NOT saved.

– If I change text on row 3 this change is saved (Most recently added row).

Am I missing some binding attribute on any of my components that would fix this?

<a4j:repeat value="#{myBean.ruleSet}" var="rule" id="ruleIterator">

    <h:dataTable value="#{rule}" var="currentRuleItem">

        <h:column>

                <h:panelGrid columns="2" cellspacing="5">
                    <h:outputLabel value="#{msg.FrequencyOfSpending}" />

                    <h:selectOneMenu id="ruleFrequencyOptions" value="#{currentRuleItem.ruleControls.ControlOne.controlParams.Period.valueSelected}" styleClass="commonSelect">
                    <f:selectItems value="#{currentRuleItem.ruleControls.ControlOne.controlParams.Period.validValues}" itemLabelEscaped="true" />
                    <f:ajax event="valueChange" listener="#{currentRuleItem.ruleControls.ControlOne.controlParams.Period.valueSelectedChange}" onerror="handleAjaxError" render="rulesGroup" />
                    </h:selectOneMenu>
                </h:panelGrid>

                <h:panelGroup id="rulesGroup">
                    <a4j:repeat value="#{currentRuleItem.ruleParams.Action.properties}" var="RuleParamProperty" id="budgetRuleIterator">

                    <h:panelGrid columns="4" cellspacing="5" columnClasses="ruleParamCheckbox, ruleParamAction, ruleParamActionFrequency, ruleParamActionInput">

                    <h:selectBooleanCheckbox value="#{RuleParamProperty.selected}" immediate="true">
                        <a4j:ajax event="click" listener="#{RuleParamProperty.selectedChange}"  onerror="handleAjaxError" />
                    </h:selectBooleanCheckbox>

                    <h:outputText value="#{msg[RuleParamProperty.name]}" />

                    <h:panelGrid columns="3">
                        <h:outputText value="#{msg.Action_1}" />
                        <h:outputText value="#{msg[currentRuleItem.ruleControls.ControlOne.controlParams.Period.valueSelected]}" class="italic-text" />   
                        <h:outputText value="#{msg.Action_3}" />
                    </h:panelGrid>

                    <h:inputText value="#{RuleParamProperty.inputValue}" />

                    </h:panelGrid>

                    </a4j:repeat>
                </h:panelGroup>

            </h:column>

    </h:dataTable>

    <!--******* Link here to generate row with exact same format as all code above ***-->
    <h:panelGrid columns="2">
        <img id="AddIcon" src="#{facesContext.externalContext.requestContextPath}/images/icons/add.png" alt="#{msg.addControl}" />
        <h:commandLink value="#{msg.addControl}" action="#{myBean.addRule}" />
    </h:panelGrid>

</a4j:repeat>

<h:panelGrid columns="2" cellspacing="5">
    <h:commandButton value="#{msg.sc_cancel}" immediate="true" action="#{myBean.cancel}" />
    <h:commandButton value="#{msg.ua_save}" action="#{myBean.saveRules}" />
</h:panelGrid>

// my bean method
public void addRule()
{   
    iRuleSet.get("RuleControl1").add(createRule());     
}

I have not include my backing bean code as it’s extremely complicated, I can edit and show snippets if required.

Thanks in advance

  • 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-08T20:38:09+00:00Added an answer on June 8, 2026 at 8:38 pm

    Ok so after many frustrating hours reading all sorts of articles about different tag handlers (c:forEach, ui:include, etc) and components (ui:repeat, h:datatable, etc..), the differences between them, the problems that can arise from mixing and mashing them, etc………

    It’s fixed (I think!)

    I removed all my ui:repeat and replaced them with Richfaces a4j:repeat which provides the additional attribute keepSaved.
    I also removed my h:dataTable and replaced it with aj4:repeat.

    Now for the life of me, I cannot find anywhere that explains what keepSaved does!!
    The Richfaces 4 API Docs are as per usual, dreadful!

    The description beside it reads just like most attributes….No Description!

    Could anyone shed some like on what this component attribute does?

    Thanks

    Solution:

    <a4j:repeat value="#{myBean.ruleSet}" var="rule" id="ruleIterator">
    
        <a4j:repeat value="#{rule}" var="currentRuleItem">
    
            <h:column>
    
                    <h:panelGrid columns="2" cellspacing="5">
                        <h:outputLabel value="#{msg.FrequencyOfSpending}" />
    
                        <h:selectOneMenu id="ruleFrequencyOptions" value="#{currentRuleItem.ruleControls.ControlOne.controlParams.Period.valueSelected}" styleClass="commonSelect">
                        <f:selectItems value="#{currentRuleItem.ruleControls.ControlOne.controlParams.Period.validValues}" itemLabelEscaped="true" />
                        <f:ajax event="valueChange" listener="#{currentRuleItem.ruleControls.ControlOne.controlParams.Period.valueSelectedChange}" onerror="handleAjaxError" render="rulesGroup" />
                        </h:selectOneMenu>
                    </h:panelGrid>
    
                    <h:panelGroup id="rulesGroup">
    
                    <a4j:repeat value="#{currentRuleItem.ruleParams.Action.properties}" var="RuleParamProperty" id="budgetRuleIterator" keepSaved="true">
    
                        <h:panelGrid columns="4" cellspacing="5" columnClasses="ruleParamCheckbox, ruleParamAction, ruleParamActionFrequency, ruleParamActionInput">
    
                        <h:selectBooleanCheckbox value="#{RuleParamProperty.selected}" immediate="true">
                            <a4j:ajax event="click" listener="#{RuleParamProperty.selectedChange}"  onerror="handleAjaxError" />
                        </h:selectBooleanCheckbox>
    
                        <h:outputText value="#{msg[RuleParamProperty.name]}" />
    
                        <h:panelGrid columns="3">
                            <h:outputText value="#{msg.Action_1}" />
                            <h:outputText value="#{msg[currentRuleItem.ruleControls.ControlOne.controlParams.Period.valueSelected]}" class="italic-text" />   
                            <h:outputText value="#{msg.Action_3}" />
                        </h:panelGrid>
    
                        <h:inputText value="#{RuleParamProperty.inputValue}" />
    
                        </h:panelGrid>
    
                        </a4j:repeat>
                    </h:panelGroup>
    
                </h:column>
    
        </a4j:repeat>
    
        <!--******* Link here to generate row with exact same format as all code above ***-->
        <h:panelGrid columns="2">
          <img id="AddIcon" src="#{facesContext.externalContext.requestContextPath}/images/icons/add.png" alt="#{msg.addControl}" />
          <a4j:commandLink value="#{msg.addControl}" action="#{myBean.addRule}">
            <f:param name="ruleType" value="BudgetRule" />
          </a4j:commandLink>
        </h:panelGrid>
    
    </a4j:repeat>
    
    <h:panelGrid columns="2" cellspacing="5">
        <h:commandButton value="#{msg.sc_cancel}" immediate="true" action="#{myBean.cancel}" />
        <h:commandButton value="#{msg.ua_save}" action="#{myBean.saveRules}" />
    </h:panelGrid>
    
    // my bean method
    public void addRule()
    {   
        iRuleSet.get("RuleControl1").add(createRule());     
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have two tables with like below codes: Table: Accounts id | username |
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

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.