Tuesday, October 20, 2009

JSP - insert simple data with jsp expression

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
   "http://www.w3.org/TR/html4/loose.dtd"> 
 
<html> 
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
        <title>java expression example</title> 
    </head> 
    <body> 
        <h1>A JSP TimeDate Stamp Example</h1> 
<!-- 
 you can use jsp expressions with the 
 shortcut percent equals or you can use 
 jsp:expression tags 
 
 --> 
 
        <p> Here is the date using the shortcut
        percent equals syntax:<br /> 
        <%= new java.util.Date() %> </p> 
 
        <p> Here is the same date stamp using the
        jsp expression tags: <br /> 
        <jsp:expression>new java.util.Date()</jsp:expression></p> 
 
 
    </body> 
</html> 
<!-- Here is my output: 
 
A JSP TimeDate Stamp Example 
 
Here is the date using the shortcut percent equals syntax: 
Tue Oct 20 10:52:53 MDT 2009 
 
Here is the same date stamp using the jsp expression tags: 
Tue Oct 20 10:52:53 MDT 2009 
 
--> 
 

No comments:

Post a Comment