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: Mon Feb 24 11:38:30 UTC 2020

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

Show network data

Your IP address is: 3.233.215.231

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