example.cmp.find
Class FindServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--example.cmp.find.FindServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class FindServlet
extends javax.servlet.http.HttpServlet

A client to illustrate Course bean's finder methods. The example uses three finder methods from the CourseHome interface:

See Also:
Serialized Form

Field Summary
private  CourseHome home
          The course local home interface.
 
Fields inherited from class javax.servlet.GenericServlet
config
 
Constructor Summary
FindServlet()
           
 
Method Summary
 void init()
          Finds the course's home interface using JNDI.
 void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, encodeBase64, generateETag, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

home

private CourseHome home
The course local home interface. It is set in the servlet's init() method.
Constructor Detail

FindServlet

public FindServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Finds the course's home interface using JNDI. Since the home interface never changes, looking it up in the init() interface avoids the relatively slow JNDI call for each request.

The course bean is located at java:comp/env/cmp/finder_CourseBean.

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - if the JNDI lookup fails.

service

public void service(javax.servlet.http.HttpServletRequest req,
                    javax.servlet.http.HttpServletResponse res)
             throws java.io.IOException,
                    javax.servlet.ServletException
Overrides:
service in class javax.servlet.http.HttpServlet