01: package test;
02:
03: import java.io.IOException;
04: import java.io.PrintWriter;
05:
06: import java.util.logging.Logger;
07:
08: import javax.servlet.ServletException;
09:
10: import javax.servlet.http.HttpServlet;
11: import javax.servlet.http.HttpServletRequest;
12: import javax.servlet.http.HttpServletResponse;
13:
14: import javax.webbeans.In;
15:
16: /**
17: * A simple servlet that uses the resource.
18: */
19: public class TestServlet extends HttpServlet {
20: private static final Logger log = Logger
21: .getLogger(TestServlet.class.getName());
22:
23: /**
24: * The saved resource from JNDI.
25: */
26: @In
27: private TestResource _resource;
28:
29: /**
30: * The doGet method just prints out the resource.
31: */
32: public void doGet(HttpServletRequest req, HttpServletResponse res)
33: throws ServletException, IOException {
34: PrintWriter out = res.getWriter();
35:
36: out.println("Resource: " + _resource);
37: }
38: }
|