<%-- initial comment --%> <%@ page import="java.util.Date" %> <%--@ page isELIgnored="true" //Now EL will be ignored --%> int day = 3; <%@ include file="relative url" %> Day <%= day %>

Today's date: <%= (new java.util.Date()).toLocaleString()%>

<%! int day = 3; %> <%-- This comment will not be visible in the page source --%>

Today's date: <%= (new java.util.Date()).toLocaleString()%>

<%! int i = 0; %> int j = 10; <%-- This is JSP comment --%> <%@ directive attribute="value" %>

Select Languages:

Java
.NET
PHP
C/C++
PERL
<% String select[] = request.getParameterValues("id"); if (select != null && select.length != 0) { out.println("You have selected: "); for (int i = 0; i < select.length; i++) { out.println(select[i]); } } %> <% switch(day) { case 0: out.println("It\'s Sunday."); break; case 1: out.println("It\'s Monday."); break; case 2: out.println("It\'s Tuesday."); break; case 3: out.println("It\'s Wednesday."); break; case 4: out.println("It\'s Thursday."); break; case 5: out.println("It\'s Friday."); break; //hello default: out.println("It's Saturday."); } %>

out.println("Your IP address is " + request.getRemoteAddr());