recently built a Web application with JavaServer Pages (JSP) and Servlets for a client. While testing the application, the client discovered a page that required her to press a button to retrieve values from the server before other fields in the page would populate. She wanted me to eliminate the "hang" that occurred when she pressed the button (i.e., submitted the page to the server), so that she could populate other fields while the application fetched values from the server.
This is a common scenario: a Web application fetches some data from the server based on user input before populating the rest of the fields in a Web page. Usually, an application submits the page to the server, which then returns the requested information back to the page. Users don't like waiting until the page refreshes with the fetched data, and developers must perform additional coding for the application to maintain any populated fields when fetching data from the server based on user input.
How do I make a Web application fetch data from the server when a user submits inputwithout hanging and while maintaining populated fields on a page?