O'Reilly logo

Sams Teach Yourself J2EE™ in 21 Days by Peter Roxburgh, Andy Longshaw, Debbie Law, Dan Haywood, Martin Bond

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

First JSP example

You are now ready to write and deploy your first JSP. The JSP in Listing 13.3 is a very simple JSP that uses an expression to generate the current date.

Listing 13.3. Full Text of date.jsp
 1: <HTML>
 2:   <HEAD>
 3:     <TITLE>JSP Date Example</TITLE>
 4:   </HEAD>
 5:   <BODY>
 6:     <BIG>
 7:       Today's date is <%= new java.util.Date() %>
 8:     </BIG>
 9:   </BODY>
10: </HTML>

Perform the following steps to deploy this JSP.

1.
Start up the J2EE RI and run deploytool.
2.
Create a new application to store your JSPs. Call it simple.
3.
Select File, New, Web Component and create a new WAR file in the application, call it Simple.
4.
Click Edit and add the JSP file date.jsp. It does not matter if your JSP source file is in a sub-directory or not, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required