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

  • Home
  • SEARCH
  • 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 5958357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:31:53+00:00 2026-05-22T18:31:53+00:00

I’m trying to use dataModel instead of binding dataTable and have this issue. At

  • 0

I’m trying to use dataModel instead of binding dataTable and have this issue. At the last column there is a commandButton which should be used for delete item from database. But when I press it, the java method isn’t started.

Part of xhtml (reduced code):

<h:form>
<rich:extendedDataTable 
  id="table"
  var="fItem"  
  value="#{myFood.model}" 
  selectionMode="none">

 <rich:column width="150px">
  <f:facet name="header">Datum:</f:facet>
  <h:outputText value="#{fItem.date}"/>
 </rich:column>

 <rich:column>
    <h:commandButton id="save" action="#{myFood.delete}" value="delete"/>
 </rich:column>

 <f:facet name="footer">  
   <h:commandButton id="btnTest" action="#{myFood.test}" value="test"/>
 </f:facet>
</rich:extendedDataTable>
</h:form>

Part of MyFood.java:

public void delete()
{
  System.out.println("TEST");
  try 
  {
    DaoCrud.delete(model.getRowData(), 'P');
  } 
  catch (Exception e) {.....}
}

public void test()
{
  System.out.println("TEST");
}

But even “TEST” is not writen to console!
Where could be the problem?

UPDATE: I’ve updated code examples (facet & test()), it works. Everything works fine until I’ve tried using dataModel private DataModel<Item> model;…
When I simply move the same commandButton to the facet, it works.

  • 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-22T18:31:53+00:00Added an answer on May 22, 2026 at 6:31 pm

    If the bean is request scoped, then you need to ensure that exactly the same model is been created during bean’s (post)construction of the form submit request as it was during displaying the initial form.

    private List<Item> list;
    private DataModel<Item> model;
    
    @PostConstruct
    public void init() {
        list = itemService.list();
        model = new ListDataModel<Item>(list);
    }
    

    JSF will namely iterate over the model during the apply request values phase to determine the button pressed so that it can be invoked during the invoke application phase.

    If preserving the model in the subsequent request isn’t exactly trivial due to some business restrictions (e.g. missing parameters, etc), then you need to put the bean in the view scope by marking it @ViewScoped instead of @RequestScoped. This works only if you’re using JSF 2.0.

    @ManagedBean
    @ViewScoped
    public class MyBean {}
    

    Alternatively, since you’re using RichFaces, you could also use <a4j:keepAlive> for this. Put this somewhere in the same page as the form:

    <a4j:keepAlive beanName="#{myBean}" />
    

    This does effectively the same as @ViewScoped does in JSF 2.0.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
Basically, what I'm trying to create is a page of div tags, each has

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.