Skip to content

Commit 2b68edc

Browse files
author
Arun Gupta
committed
Better output messages
1 parent 5d769e7 commit 2b68edc

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

servlet/event-listeners/src/main/java/org/javaee7/servlet/event/listeners/TestServlet.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,28 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
7070
out.println("<!DOCTYPE html>");
7171
out.println("<html>");
7272
out.println("<head>");
73-
out.println("<title>Servlet TestServlet</title>");
73+
out.println("<title>Servlet Event Listeners</title>");
7474
out.println("</head>");
7575
out.println("<body>");
76-
out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>");
77-
out.println("Setting, updating, and removing ServletContext Attributes<br><br>");
76+
out.println("<h1>Servlet Event Listeners</h1>");
77+
out.println("<h2>Setting, updating, and removing ServletContext Attributes</h2>");
7878
request.getServletContext().setAttribute("attribute1", "attribute-value1");
7979
request.getServletContext().setAttribute("attribute1", "attribute-updated-value1");
8080
request.getServletContext().removeAttribute("attribute1");
81-
out.println("Setting, updating, and removing HttpSession Attributes<br><br>");
81+
out.println("done");
82+
out.println("<h2>Setting, updating, and removing HttpSession Attributes</h2>");
8283
request.getSession(true).setAttribute("attribute1", "attribute-value1");
8384
request.getSession().setAttribute("attribute1", "attribute-updated-value1");
8485
request.getSession().removeAttribute("attribute1");
85-
out.println("Setting, updating, and removing ServletRequest Attributes<br><br>");
86+
out.println("done");
87+
out.println("<h2>Setting, updating, and removing ServletRequest Attributes</h2>");
8688
request.setAttribute("attribute1", "attribute-value1");
8789
request.setAttribute("attribute1", "attribute-updated-value1");
8890
request.removeAttribute("attribute1");
91+
out.println("done");
92+
out.println("<h2>Invalidating session</h2>");
8993
request.getSession().invalidate();
94+
out.println("done");
9095
out.println("Check output in server.log");
9196
out.println("</body>");
9297
out.println("</html>");

servlet/event-listeners/src/main/webapp/index.jsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@
4646
<html>
4747
<head>
4848
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
49-
<title>Servlet Event Listeners</title>
49+
<title>Servlet : Event Listeners</title>
5050
</head>
5151
<body>
52-
<h1>Servlet Event Listeners</h1>
52+
<h1>Servlet : Event Listeners</h1>
5353
Call the <a href="${pageContext.request.contextPath}/TestServlet"/>servlet</a> to set/update/remove attributes.
5454
</body>
5555
</html>

0 commit comments

Comments
 (0)