Skip to content

Commit a6d0342

Browse files
committed
Added Spring escapeBody sample
1 parent 9b1ae9d commit a6d0342

File tree

1 file changed

+8
-4
lines changed
  • Ch04_OutputEscapingJSP/src/main/webapp/WEB-INF/views

1 file changed

+8
-4
lines changed
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
22
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
3+
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
34
<html>
45
<head>
56
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@@ -9,10 +10,13 @@
910
<body>
1011
<h1>Ch04_OutputEscapingJSP: New Contact</h1>
1112

12-
<h2>Input with direct value expression</h2>
13-
<p><strong>Hello</strong> ${contact.firstname} ${contact.lastname}</p>
13+
<h2>Input displayed as direct value expression</h2>
14+
<p><strong>Contact details:</strong> ${contact.firstname} ${contact.lastname}</p>
1415

15-
<h2>Input with out element</h2>
16-
<p><strong>Hello</strong> <c:out value="${contact.firstname}" /> <c:out value="${contact.lastname}" /></p>
16+
<h2>Input displayed as out element</h2>
17+
<p><strong>Contact details:</strong> <c:out value="${contact.firstname}" /> <c:out value="${contact.lastname}" /></p>
18+
19+
<h2>Input displayed inside Spring escapeBody element as direct value expression</h2>
20+
<p><strong>Contact details:</strong> <s:escapeBody htmlEscape="true">${contact.firstname} ${contact.lastname}</s:escapeBody> </p>
1721
</body>
1822
</html>

0 commit comments

Comments
 (0)