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

The Archive Base Latest Questions

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

Can somebody recommend any framework to facilitate CRUD development in JSF 2.0? Aspects I

  • 0

Can somebody recommend any framework to facilitate CRUD development in JSF 2.0?

Aspects I value most:

  • As lightweight as possible; limited dependencies on third party libraries
  • Support for an evolving domain model
  • Limited need for repetitive coding; support for scaffolding and/or metaannotations

Any hints highly appreciated!
Yours,
J.

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

    CRUD is indeed a piece of cake using JSF 2.0 provided standard facility: a @ViewScoped bean in combination with a <h:dataTable> basically already suffices. Here’s a code example which is shamelessly copied from this article.

    Bean:

    package com.example;
    
    import java.io.Serializable;
    import java.util.ArrayList;
    import java.util.List;
    
    import javax.annotation.PostConstruct;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.ViewScoped;
    
    @ManagedBean
    @ViewScoped
    public class Bean implements Serializable {
    
        private List<Item> list;
        private Item item = new Item();
        private boolean edit;
    
        @PostConstruct
        public void init() {
            // list = dao.list();
            // Actually, you should retrieve the list from DAO. This is just for demo.
            list = new ArrayList<Item>();
            list.add(new Item(1L, "item1"));
            list.add(new Item(2L, "item2"));
            list.add(new Item(3L, "item3"));
        }
    
        public void add() {
            // dao.create(item);
            // Actually, the DAO should already have set the ID from DB. This is just for demo.
            item.setId(list.isEmpty() ? 1 : list.get(list.size() - 1).getId() + 1);
            list.add(item);
            item = new Item(); // Reset placeholder.
        }
    
        public void edit(Item item) {
            this.item = item;
            edit = true;
        }
    
        public void save() {
            // dao.update(item);
            item = new Item(); // Reset placeholder.
            edit = false;
        }
    
        public void delete(Item item) {
            // dao.delete(item);
            list.remove(item);
        }
    
        public List<Item> getList() {
            return list;
        }
    
        public Item getItem() {
            return item;
        }
    
        public boolean isEdit() {
            return edit;
        }
    
        // Other getters/setters are actually unnecessary. Feel free to add them though.
    
    }
    

    Page:

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html">
        <h:head>
            <title>Really simple CRUD</title>
        </h:head>
        <h:body>
            <h3>List items</h3>
            <h:form rendered="#{not empty bean.list}">
                <h:dataTable value="#{bean.list}" var="item">
                    <h:column><f:facet name="header">ID</f:facet>#{item.id}</h:column>
                    <h:column><f:facet name="header">Value</f:facet>#{item.value}</h:column>
                    <h:column><h:commandButton value="edit" action="#{bean.edit(item)}" /></h:column>
                    <h:column><h:commandButton value="delete" action="#{bean.delete(item)}" /></h:column>
                </h:dataTable>
            </h:form>
            <h:panelGroup rendered="#{empty bean.list}">
                <p>Table is empty! Please add new items.</p>
            </h:panelGroup>
            <h:panelGroup rendered="#{!bean.edit}">
                <h3>Add item</h3>
                <h:form>
                    <p>Value: <h:inputText value="#{bean.item.value}" /></p>
                    <p><h:commandButton value="add" action="#{bean.add}" /></p>
                </h:form>
            </h:panelGroup>
            <h:panelGroup rendered="#{bean.edit}">
                <h3>Edit item #{bean.item.id}</h3>
                <h:form>
                    <p>Value: <h:inputText value="#{bean.item.value}" /></p>
                    <p><h:commandButton value="save" action="#{bean.save}" /></p>
                </h:form>
            </h:panelGroup>
        </h:body>
    </html>
    

    Further, Netbeans has some useful wizards to genreate a CRUD application based on a datamodel.

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

Sidebar

Related Questions

can somebody recommend me good affordable IP KVM? Like Adder. Or some articles evaluating
Can somebody recommend me a software or algorithm in Matlab, c++ with them i
Can sombody recommend me a good captcha tool for my JSF pages? Is there
Can somebody recommend the best (and preferably portable) way to render HTML documents onto
Can somebody please recommend a good multi-column combobox control for use in a Web
Can somebody recommend an easy to use Lightbox plug-in for ExtJS 4? The best
Can somebody recommend a free C++ open source library which I will use to
Can somebody point me to a resource that explains how to go about having
Can somebody suggest a good free tool for analyzing .Net memory dumps other than
Can somebody remember what was the command to create an empty file in MSDOS

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.