#
Java Server Pages (JSP)
Java Server Pages (JSP) is a server-side programming technology that enables the creation of Dynamic Web Pages, like Servlet technology (but JSP pages are easier to create and maintain). JavaServer Page (JSP) is Java's answer to the popular Microsoft's Active Server Pages (ASP). These JSP pages are created using the JSTL. The JavaServer Pages Standard Tag Library (JSTL) is a collection of JSP tags which can be used in creation of the Web Pages (dynamically).
For My example I will use WildFly Server and Eclipse IDE. For my project I created the following pages:
- index.html file (a 100% HTML page) which call the JSP page
- JavaJspPageExample.jsp - the JSP page
In my example I call the JSP page from the index.html page.
Here are the 2 files:
<html>
<head>
<meta charset="ISO-8859-1">
<title> This page will send a request to a Java JSP Page. </title>
</head>
<body>
<a> This page will <b>send a request</b> to a <b>Java JSP Page</b>. </a>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<form action="JavaJspPageExample.jsp">
Name: <input type="text" name="name">
<br>
Telephone#: <input type="text" name="telephone">
<input type="submit" value="Submit">
</form>
</body>
</html>
<html>
<head>
<title>This is a Java JSP Page - Example</title>
</head>
<body>
<b><big>This is a Java JSP Page - Example</big></b>
<br>
This is a clasic HTML content into a JSP Page !
<br><br>
From the index.html I have received into JSP Page
the <b>name</b> parameter. Name =
<%= request.getParameter("name") %>
<br>
From the index.html I have received into JSP Page
the <b>telephone</b> parameter. Telephone# =
<%= request.getParameter("telephone") %>
</body>
</html>
When you run the project you will hit the index.html page:
Enter some data and click on "Submit". You will see the JSP Page with the values you entered the index.html form:
Info
As you can see the JSP pages are a HTML & JSP tags combination ! Now the Java server Faces (JSF) replace the usage of the JSP.