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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:47:05+00:00 2026-06-09T22:47:05+00:00

so I found this issue, it is really weird.. So I have this xhtml

  • 0

so I found this issue, it is really weird..

So I have this xhtml page:

<h:form>
        <rich:dataTable value="#{carsBean.myList}" var="car">
            <rich:column>
                <f:facet name="header">
                    <h:outputText value="Name" />
                </f:facet>
                <h:inputText value="#{car.name}">
                    <p:ajax event="keyup" listener="#{carsBean.print}" />
                </h:inputText>
            </rich:column>
            <rich:column>
                <f:facet name="header">
                    <h:outputText value="Company" />
                </f:facet>
                <h:inputText value="#{car.company}">
                    <p:ajax event="keyup" listener="#{carsBean.print}" />
                </h:inputText>
            </rich:column>
            <rich:column>
                <f:facet name="header">
                    <h:outputText value="Address" />
                </f:facet>
                <h:inputText value="#{car.address}">
                    <p:ajax event="keyup" listener="#{carsBean.print}" />
                </h:inputText>
            </rich:column>
        </rich:dataTable>
        <h:commandButton value="save-empty">

        </h:commandButton>
    </h:form>

The following is the managedbean:

@ManagedBean(name="carsBean")
@SessionScoped
public class CarsBean implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = -7818770780064447805L;
    private List<Car> myList;
    private String test;

    public CarsBean(){}

    public void print(){
        System.out.println("I got hit!");
    }

    /**
     * @return the myList
     */
    @PostConstruct
    void initialiseSession() {
        FacesContext fc = FacesContext.getCurrentInstance();
        fc.getExternalContext().getSession(true);
        if(myList==null){
            myList = new ArrayList<Car>();
        };
        if(myList.isEmpty()){
            for(int a=0;a<10;a++){
                myList.add(new Car("test","test","test"));
            }
        }
    }

    public List<Car> getMyList() {
        return myList;
    }

    /**
     * @param myList the myList to set
     */
    public void setMyList(List<Car> myList) {
        this.myList = myList;
    }

    public String getTest() {
        return test;
    }

    public void setTest(String test) {
        this.test = test;
    }

    public static class Car{
        private String name;
        private String company;
        private String address;

        public Car(){}

        public Car(String name, String company, String address) {
            super();
            this.name = name;
            this.company = company;
            this.address = address;
        }

        /**
         * @return the name
         */
        public String getName() {
            return name;
        }
        /**
         * @param name the name to set
         */
        public void setName(String name) {
            this.name = name;
        }
        /**
         * @return the company
         */
        public String getCompany() {
            return company;
        }
        /**
         * @param company the company to set
         */
        public void setCompany(String company) {
            this.company = company;
        }
        /**
         * @return the address
         */
        public String getAddress() {
            return address;
        }
        /**
         * @param address the address to set
         */
        public void setAddress(String address) {
            this.address = address;
        }
    }
}

Now the aim is to save the users input in the sessionscope such that even if the user closes the tab or makes a new request the data gets persisted.

The above code works, but I have noticed, when I remove the ajax events on the input box it dosent.

Any ideas?

THanks

  • 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-09T22:47:07+00:00Added an answer on June 9, 2026 at 10:47 pm

    The ajax events are causing your changes to be sent to the server, and persisted in the session. If you don’t have them, you will need something else to do it. Clasically, you would do a normal post (any submit button on your form will do, really). But your users will have to click the button to explicitly save their changes.

    If your goal is really that your users can play around, close their tab, and when they come back everything is as they left it, you will need the ajax events anyway.

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

Sidebar

Related Questions

I know this issue has been touched on here but I have not found
I have found a few threads in regards to this issue. Most people appear
I have a really weird issue that I can't figure out with comparing objects
After repeated searching I have not found an elegant solution to this issue: how
Has anyone else had this issue and found a working solution? I've enabled the
I can't resolve this issue, I found a similar question here but: setting the
I've been struggling with this issue for a little while now. Found several posts
I found out the next issue in this simple code: let () = print_endline
I looked hours to solve this issue, and found nothing. Sorry if answer is
I have a bit of strange problem on this page: http://www.bluprintliving.com/locations it seems that

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.