The scriptlet tag is used to write java class statements inside the jspService() method. In other words, writing java code in a Java Server Page is done through scriptlet tag. A scriptlet tag starts with <% and ends with %>.
example: insert the following codes between the <body> tags.
<% // This scriptlet declares and initializes "date" System.out.println( "Evaluating date now" ); java.util.Date date = new java.util.Date(); %> The time is now: <% // The following scriptlets generate HTML output out.println( String.valueOf( date )); out.println( "<br>Your machine's address is: " ); out.println( request.getRemoteHost()); %> |