A Bit About JSPs
Introduction.
JSPs seem to operate pretty much like their other middleware counterparts
PHPs and ASPs. The code for JSPs is really Java like, but it is
usually embedded within HTML in order to operate. There seem to be
two main overall requirements in order to create a JSP page.
They are probably more like ASPs than PHPs, but the similarities between all three are clear upon investigation. The web server, Tomcat is used to convert JSPs into Servlets which are then run on the web server. Tomcat can actually function as a complete web server but it is most often used in conjunction with Apache. The name of the processor that converts JSP into Servlets is Jasper. Hello World. In order to work a simple example and test your abilities to FTP we will now develop hello_world.jsp. |
<html> <head> <title>Hello World JSP Page</title> </head> <body> <%
%> |
When you
You should see something like the following. |
Cubes. Now we will work another example that makes use of your background in Java. You should call this cubes.jsp. |
<html> <head> <title>Calculating Cubes</title> </head> <body bgcolor = "000044" text="cccccc"> <% out.println("<h2><B>Cubes</B></h2><BR>"); int iLoop; int iCube; for (iLoop = 1; iLoop <= 10; iLoop++) {
} |
In this instance I have mixed HTML and Java variables
within the out class println( ) method. We also make use of a for
loop. Your output should look something like the following. |