|
STEP 5: Create and execute a
JSP
|
C:\Documents and Settings\ choose New -> All Templates
2. Choose Web Module under node JSPs & Servlets

3. Click Next and accept the Web Module Directory (You may change the directory as you wish)
4. Notice now a new Web module is created (WEB-INF and META-INF)

5. Right-click on the C:\Documents and Settings\ choose New -> All Templates
Choose JSP under node JSPs in JSPs&Servlets

6. Accept the setting and click Finish, you may change the file name instead of index.
7. Replace the code with the following:
|
<html> <title>Simple JSP</title> <body> <%-- JSP comment --%> <!-- HTML comment --> <!-- DIRECTIVES --> <%@ page language = "java" %> <%@ page import = "java.util.*" %> <%@ page contentType = "TEXT/HTML" %> <!-- SCRIPLETS --> <H3> <% if (Calendar.getInstance().get(Calendar.AM_PM) == Calendar.AM) { %> Good morning <% } else { %> Good afternoon <% } %> </H3> <!-- ACCESSING IMPLICIT OBJECTS --> <% out.println("This is a Simple JSP"); %> </body> </html>
|
8. Right-click on the JSP node to Validate and then Execute it.
9. Now you will see the Simple JSP pop-up
