Core basic Java web server technologies
Tools Eclipse IDE for Java EE Developers (Netbeans also works) nloads/packages/eclipse- ide-java-ee- developers/keplersr2 Application server (e.g. Tomcat, GlassFish) download-80.cgi#8.0.28
Create a dynamic web project
JSPs (Java Servlet Pages) JSPs are one of the core building blocks of Java web applications, allowing us to combine HTML and Java seamlessly JSP lifecycle: We can embed Java code into JSP with scriptlet tags
<% java.util.Date today = new java.util.Date(); String mess = "Today is "+today; %> Or <% java.util.Date today = new java.util.Date(); String mess = "Today is "+today; out.println(mess); %> Output Press CTRL+Space Scriplets
For deployment
Steps for deployment on your local computer Right-click on the project->Export->WAR Copy the war file into webapps folder from your Tomcat installation folder Close the Tomcat from Eclipse and open it from Startup You should be able to see the results when calling your web application from localhost You can deploy your web application for free on Google App Engine, etc by uploading your war
How to import Java classes into JSPs
How to retrieve parameters from the URL in JSPs
Java Servlet A servlet is a Java class that runs in an "application server" and sends web pages back to a browser when a user somewhere in the world clicks on a URL.
To get some URL parameters…
Work with scriplets and HTML
The include directive vs the include jsp tag Static include includes smth into the page, before compiling and sending it to the browser (directive) Dynamic include takes place at runtime (jsp tag)
Going from jsp page/servlet to another jsp page/servlet In forward, you see the content of your forwarded page, but the url of the initial page. In redirect, you see for a second the content of your initial page, then you see your redirected page and, also, its url.
Declaration tag
Summary of JSP tags so far…