01: package example;
02:
03: import java.io.IOException;
04: import java.io.PrintWriter;
05:
06: import javax.servlet.ServletException;
07:
08: import javax.servlet.http.HttpServlet;
09: import javax.servlet.http.HttpServletRequest;
10: import javax.servlet.http.HttpServletResponse;
11:
12: import javax.webbeans.In;
13:
14: public class HelloServlet extends HttpServlet {
15: // Dependency injection for the hello bean
16: @In
17: private Hello _hello;
18:
19: public void service(HttpServletRequest req, HttpServletResponse res)
20: throws IOException, ServletException {
21: PrintWriter out = res.getWriter();
22:
23: out.println(_hello.hello());
24: }
25: }
|