53
53
*/
54
54
@ WebServlet (urlPatterns = {"/TestServletWithInterface" })
55
55
public class TestServlet extends HttpServlet {
56
-
56
+
57
57
// Cannot be injected using @Inject
58
- @ EJB Account bean ;
58
+ @ EJB
59
+ Account bean ;
59
60
60
61
/**
61
62
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
@@ -69,20 +70,19 @@ public class TestServlet extends HttpServlet {
69
70
protected void processRequest (HttpServletRequest request , HttpServletResponse response )
70
71
throws ServletException , IOException {
71
72
response .setContentType ("text/html;charset=UTF-8" );
72
- try (PrintWriter out = response .getWriter ()) {
73
- out .println ("<!DOCTYPE html>" );
74
- out .println ("<html>" );
75
- out .println ("<head>" );
76
- out .println ("<title>Stateless Bean (with Interface)</title>" );
77
- out .println ("</head>" );
78
- out .println ("<body>" );
79
- out .println ("<h1>Stateless Bean (with Interface)</h1>" );
80
- out .println ("<h2>Withdraw/Deposit</h2>" );
81
- bean .deposit ((float )10.0 );
82
- out .println ("Withdrawn : " + bean .withdraw ());
83
- out .println ("</body>" );
84
- out .println ("</html>" );
85
- }
73
+ PrintWriter out = response .getWriter ();
74
+ out .println ("<!DOCTYPE html>" );
75
+ out .println ("<html>" );
76
+ out .println ("<head>" );
77
+ out .println ("<title>Stateless Bean (with Interface)</title>" );
78
+ out .println ("</head>" );
79
+ out .println ("<body>" );
80
+ out .println ("<h1>Stateless Bean (with Interface)</h1>" );
81
+ out .println ("<h2>Withdraw/Deposit</h2>" );
82
+ bean .deposit ((float ) 10.0 );
83
+ out .println ("Withdrawn : " + bean .withdraw ());
84
+ out .println ("</body>" );
85
+ out .println ("</html>" );
86
86
}
87
87
88
88
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
0 commit comments