The Movies Listing Servlet

The movies are listed using the MoviesChooser servlet shown below. This servlet reads values from the session object to get the name of the SQL query to execute and the name of the XSLT template to use. These values relate to the names of init parameters in the web.xml file for the servlet context where the movie store application is deployed. We retrieve the session values and the corresponding init parameter values in the doGet method, since the shared servlet code may potentially have different callers from different sessions.

Within the doGet method, the query is executed (using the getQueryResults method) and the results are returned as an XML document. An XML parser and transformer are then created using the XSLT ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software 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.