JSP files contain HTML tags along with embedded code that allows the page to access data from Java code running on the server. When a page is requested by a user the HTML portion of the page is only viewed. The code portions of the pages are executed at the time the request is received, and the dynamic content generated by this code is spliced into the page before it is sent to the user. This separate the HTML from the programming logic contained in the code
CLICK HERE to download this complete example (zip file)
Steps to Create a JSP Application (Simple Example)
A JSP application may consist of HTML, JavaBean, or JSP files. You need to follow the following steps to create a JSP application:
Now goto Start -> Programs -> Sun Microsystems ->Application Server PE -> Start Default Server (wait till it start and then press any key). CLICK HERE to see how to Start the Server
Next goto Start -> Programs -> Sun Microsystems ->Application Server PE -> Deploytool. CLICK HERE to see how to Start the Deploytool Now in the deploytool,
Goto File ->New -> Application
(Click the Browse button)
(Select the folder in the Look In dropdown box, and then give a file name "Calculation". Next click the New Application button)
(Click the OK button)
Now goto File -> Save to save the file
Next, goto File -> New -> Web Component
(Click Next button)
(Enter the WAR Name as "CalApp" and then click the Edit Contents… button)
(Select all the .class, .jsp , .tld and .html files and click the Add button)
(Now click the OK button)
(Now click the Next button)
(Now select the JSP Page option button and then click the Next button)
(Now select the "a.jsp" from the Servlet Class dropdown box)
(Now select the Next button)
(Now select the Finish button)
(Now select the CalApp in the left pane and select the General tab in the right pane. Here give a name calculation in the Context Root text box)
Note: Here, no need Aliases name because the client HTML file directly calls the JSP file
Now goto File ->Save
Next goto Tools -> Deployee
(Enter the User Name as “admin” and Password as “password” (CLICK HERE for password). Next click the OK button)
(Now a message --- Operation Completed Successfully --- must display. Next click the Close button)