Home > J2EE, JSP, Technical > Greeting in JSP

Greeting in JSP

February 28, 2012

Code:

=====

<%
java.util.Calendar test=new java.util.GregorianCalendar();
String timing=null;
if(test.get(test.HOUR_OF_DAY) <12){
timing=”Morning”;
}
else if(test.get(test.HOUR_OF_DAY) < 18 )
timing=”Afternoon”;
else
timing=”Evening”;
%>
Good <%=timing%> Karuvachi !!!

Save as Greeting.jsp under \webapps\ROOT folder

Open a web browser and type http://localhost:8080/Greeting.jsp

 

Advertisements
Categories: J2EE, JSP, Technical
%d bloggers like this: