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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:30:25+00:00 2026-06-08T18:30:25+00:00

Beginner question concerning changing the information in a view (and not going to a

  • 0

Beginner question concerning changing the information in a view (and not going to a different .xhtml page). My .xhtml displays a datatable (which shows a list of people), but I want the user to be able to narrow the amount of info displayed by typing in the start of someones name into an inputtext and then clicking the commandbutton. Both the commandbutton and the datatable execute the same bean method, but if the inputtext has data the sql uses Like (this uses jdbc). My form is below, the problem is that I get an “Unable to find matching navigation case with from-view-id” because my managed bean returns a list of objects, not “success” or “failure”. Also, the whole form seems inefficient. This seems like a fairly common scenario – calling managed bean’s method that returns objects and not navigation instructions. How do I get rid of the error messages? Is there a better way to do this?

Here is code:

<h:head>
    <h:outputStylesheet library="css" name="table-style.css"  />
</h:head>

<h:body>

    <h1>MavenWeb</h1>

    <h:form>
        <h:panelGrid columns="3">
            Select a customer:

            <h:inputText id="listName" value="#{customer.listName}" 
                size="20" >
            </h:inputText>
            <h:commandButton value="Submit"
                                         action="#customer.getCustomerList()}" />

        </h:panelGrid>



    <h:dataTable value="#{customer.getCustomerList()}" var="c"
            styleClass="order-table"
            headerClass="order-table-header"
            rowClasses="order-table-odd-row,order-table-even-row"
        >

        <h:column>
            <f:facet name="header">
                Customer ID
            </f:facet>
                #{c.customerID}
        </h:column>

        <h:column>
            <f:facet name="header">
                Name
            </f:facet>
                #{c.name}
        </h:column>

        <h:column>
            <f:facet name="header">
                Address
            </f:facet>
                #{c.address}
        </h:column>

        <h:column>
            <f:facet name="header">
                Created Date
            </f:facet>
                #{c.created_date}
        </h:column>

    </h:dataTable>
</h:form>
</h:body>
  • 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-08T18:30:26+00:00Added an answer on June 8, 2026 at 6:30 pm

    First, make sure your managed bean has ViewScope, so only the form values will be affected on every request while you’re in the same view. Second, you can add ajax behavior to your <h:commandButton> and render the <h:datatable> with the new values. Third, never put business logic inside your attribute getters, because the JSF framework could make 2 or more calls of those getters (depending on your design).

    Using these rules, you can remake your code like this:

    @ViewScoped
    @ManagedBean
    public class Customer {
        private String listName;
        private List<CustomerDTO> customerList;
    
        public Customer() {
            listName = "";
            customerList = null; //maybe you can initialize your list here
        }
    
        //getters and setters...
    
        //look that this method returns a void (no need to return a navigation rule)
        public void fillCustomerList() {
            //your method/way to fill the customerList goes here...
            //I'll just put a code example
            customerList = new ArrayList<CustomerDTO>();
            customerList.add(new CustomerDTO(1, "Luiggi Mendoza", "Lima", new Date());
            customerList.add(new CustomerDTO(2, "StackOverflow", "Web", new Date());
        }
    
    }
    

    The code fragment for your page

    <h:form>
        <h:panelGrid columns="3">
            Select a customer:
            <h:inputText id="listName" value="#{customer.listName}" size="20" />
            <h:commandButton value="Submit" action="#customer.fillCustomerList}">
                <f:ajax execute="@this" render="dtMyDataTable" />
            </h:commandButton>
        </h:panelGrid>
    
        <h:dataTable id="dtMyDataTable" value="#{customer.customerList}" var="c"
            styleClass="order-table"
            headerClass="order-table-header"
            rowClasses="order-table-odd-row,order-table-even-row">
            <h:column>
                <f:facet name="header">
                    Customer ID
                </f:facet>
                #{c.customerID}
            </h:column>
            <h:column>
                <f:facet name="header">
                    Name
                </f:facet>
                #{c.name}
            </h:column>
            <h:column>
                <f:facet name="header">
                    Address
                </f:facet>
                #{c.address}
            </h:column>
            <h:column>
                <f:facet name="header">
                    Created Date
                </f:facet>
                #{c.created_date}
            </h:column>
         </h:dataTable>
    </h:form>
    

    More info on this matter:

    • Does view scope bean survive Navigation JSF
    • Learning JSF2: Ajax in JSF – using f:ajax tag
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question : Beginner Level Code: Pure Javascript I had created a web page in
Beginner question here. I'm going to make a Jquery function that is used to
Really beginner question here. I have an NSArray of images which in its last
Beginner question... How different is define($a,365); from $a = 365; ? Thanks! JDelage
Git beginner question: I have a small private webproject which is versioned locally with
It's probably beginner question but I'm going through documentation for longer time already and
I'm asking this as a general/beginner question about R , not specific to the
Beginner question: I have a dictionary where the values are lists of (a variable
Absolute beginner question: I have a template file index.html that looks like this: ...
Probably a very basic beginner question. Imagine the following situation: I have an ASP.NET

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.