org.projectlombok
lombok
@@ -100,6 +110,7 @@
1.2
2.4.4
2.17.1
+ 1.10.0
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-jsp/src/main/java/com/baeldung/boot/jsp/controller/JSPVariableController.java b/spring-boot-modules/spring-boot-jsp/src/main/java/com/baeldung/boot/jsp/controller/JSPVariableController.java
new file mode 100644
index 0000000000..c85d588c07
--- /dev/null
+++ b/spring-boot-modules/spring-boot-jsp/src/main/java/com/baeldung/boot/jsp/controller/JSPVariableController.java
@@ -0,0 +1,31 @@
+package com.baeldung.boot.jsp.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+@RequestMapping("/jsp-var")
+public class JSPVariableController {
+
+ @GetMapping("/by-jsp")
+ public String byJsp() {
+ return "/jsp-var/by-jsp";
+ }
+
+ @GetMapping("/by-el")
+ public String byEl() {
+ return "/jsp-var/by-el";
+ }
+
+ @GetMapping("/by-jstl")
+ public String byJstl() {
+ return "/jsp-var/by-jstl";
+ }
+
+ @GetMapping("/to-dom")
+ public String byDom() {
+ return "/jsp-var/to-dom";
+ }
+
+}
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/jsp-var/by-el.jsp b/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/jsp-var/by-el.jsp
new file mode 100644
index 0000000000..381df4f5eb
--- /dev/null
+++ b/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/jsp-var/by-el.jsp
@@ -0,0 +1,18 @@
+<%@ page import="org.apache.commons.text.StringEscapeUtils" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ String jspMsg = StringEscapeUtils.escapeEcmaScript("Hello! This is Sam's page.");
+ request.setAttribute("jspMsg", jspMsg);
+%>
+
+
+ Conversion by JSP EL
+
+
+
+ Open the browser console to see the message.
+
+
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/jsp-var/by-jsp.jsp b/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/jsp-var/by-jsp.jsp
new file mode 100644
index 0000000000..84c1f0db29
--- /dev/null
+++ b/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/jsp-var/by-jsp.jsp
@@ -0,0 +1,16 @@
+<%@ page import="org.apache.commons.text.StringEscapeUtils" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ String jspMsg = StringEscapeUtils.escapeEcmaScript("Hello! This is Sam's page.");
+%>
+
+
+ Conversion by JSP expression tag
+ var jsMsg = '<%=jspMsg%>';
+ console.info(jsMsg);
+
+
+
+ Open the browser console to see the message.
+
+
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/jsp-var/by-jstl.jsp b/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/jsp-var/by-jstl.jsp
new file mode 100644
index 0000000000..5ac4bc8daa
--- /dev/null
+++ b/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/jsp-var/by-jstl.jsp
@@ -0,0 +1,19 @@
+<%@ page import="org.apache.commons.text.StringEscapeUtils" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%
+ String jspMsg = StringEscapeUtils.escapeEcmaScript("Hello! This is Sam's page.");
+ request.setAttribute("scopedMsg", jspMsg);
+%>
+
+
+ Conversion by JSTL
+
+
+
+ Open the browser console to see the message.
+
+
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/jsp-var/to-dom.jsp b/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/jsp-var/to-dom.jsp
new file mode 100644
index 0000000000..2f44e5e664
--- /dev/null
+++ b/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/jsp-var/to-dom.jsp
@@ -0,0 +1,19 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ String jspTag = "Hello
";
+%>
+
+
+ Convert to an HTML tag
+
+
+
+ <%=jspTag%>
+ Open the browser console to see the tags.
+
+
\ No newline at end of file