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, ... |
Get Sams Teach Yourself J2EE™ in 21 Days now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.