Servlets - Java Server Pages

The following lines show simple examples of dynamic content generated by jsp tags. Parts of the tags are shown below the examples.
This page, with its .jsp extension, is the source for a web application, which is compiled as a war and deployed on a Glassfish server.
As with all the other examples, the page style is consistent with the rest of the site and html code allows for navigation between Glassfish and non-Glassfish pages.

Dynamically calculate the length of a string

Using the jsp standard tag library we can take the entered string and calculate the number of characters in it.

String: Enter your text here!
String Length: 21
<%= textstring.length()%>

Date functions

The date today is: Sat Apr 17 20:50:01 UTC 2021

<%= (new java.util.Date())%>

Show network data

Your IP address is:

<% out.println(request.getRemoteAddr()); %>