8.6. A Customized Search Engine Interface
Listing 8.5 shows the CustomizedSearchEngines servlet, a variation of the SearchEngines example previously shown in Section 6.3. Like the SearchEngines servlet (see Figure 8-5), the CustomizedSearchEngines servlet reads the user choices from the HTML front end and forwards them to the appropriate search engine. In addition, the CustomizedSearchEngines servlet returns to the client cookies that store the search values. Then, when the user comes back to the front-end servlet at a later time (even after quitting the browser and restarting), the front-end page is initialized with the values from the previous search.
Figure 8-5. Result of CustomizedSearchEngines servlet.
Listing 8.4. LongLivedCookie.java
Get Core Servlets and JavaServer Pages™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.