example.cmp.basic
Class CourseServlet
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--example.cmp.basic.CourseServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class CourseServlet
- extends javax.servlet.http.HttpServlet
The basic CourseClient shows the basic flow of any Resin-CMP client.
- See Also:
- Serialized Form
Field Summary |
private CourseHome |
home
Cached reference to the CourseHome interface. |
private javax.transaction.UserTransaction |
userTrans
Cached reference to the UserTransaction. |
Fields inherited from class javax.servlet.GenericServlet |
config |
Method Summary |
void |
init()
Initializes the reference to the CourseBean home interface. |
void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Illustrates how to interact with the Course EJB |
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 |
home
private CourseHome home
- Cached reference to the CourseHome interface. Because this object
never changes, the client can look it up once in the
init()
method and avoid JNDI calls for each request.
userTrans
private javax.transaction.UserTransaction userTrans
- Cached reference to the UserTransaction. Because this object
never changes, the client can look it up once in the
init()
method and avoid JNDI calls for each request.
Normally, Resin-CMP clients will use business methods to
encapsulate transactions. This example uses an explicit
UserTransaction to explain more clearly what's going on.
CourseServlet
public CourseServlet()
init
public void init()
throws javax.servlet.ServletException
- Initializes the reference to the CourseBean home interface.
- Overrides:
init
in class javax.servlet.GenericServlet
service
public void service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.io.IOException,
javax.servlet.ServletException
- Illustrates how to interact with the Course EJB
- Overrides:
service
in class javax.servlet.http.HttpServlet