Web technologies -- Laboratory 8 -- 2007-2008 -- info.uvt.ro
Appearance
Navigation
[edit]- Web technologies -- 2007-2008 -- info.uvt.ro
- Web technologies -- Laboratory 1 -- 2007-2008 -- info.uvt.ro
- Web technologies -- Laboratory 2 -- 2007-2008 -- info.uvt.ro
- Web technologies -- Laboratory 3 -- 2007-2008 -- info.uvt.ro
- Web technologies -- Laboratory 4 -- 2007-2008 -- info.uvt.ro
- Web technologies -- Laboratory 5 -- 2007-2008 -- info.uvt.ro
- Web technologies -- Laboratory 6 -- 2007-2008 -- info.uvt.ro
- Web technologies -- Laboratory 7 -- 2007-2008 -- info.uvt.ro
- Web technologies -- Laboratory 8 -- 2007-2008 -- info.uvt.ro
- Web technologies -- Laboratory 9 -- 2007-2008 -- info.uvt.ro
- Web technologies -- Laboratory 10 -- 2007-2008 -- info.uvt.ro
JSP -- JavaServer Pages
[edit]References
[edit]Tutorials
[edit]- Java EE 5 Tutorial
- JavaServer Pages: A Developer's Perspective
- Servlets and JavaServer Pages (JSP) 1.0: A Tutorial
- JSP tutorial -- 1
- JSP tutorial -- 2
Discussion points
[edit]- comparisons between JSP and:
- servlets;
- static HTML;
- content:
- static;
- dynamic;
- syntax:
- standard;
- XML based;
- constructs:
- static:
<html> <head>...</head> <body>...</body> </html>
- scripting:
- expressions:
- scripting:
<%= java expression %> <jsp:expression>java expression</jsp:expression>
- scriptlet (code):
<% java code %> <jsp:scriptlet>java code</jsp:scriptlet>
- declaration:
<%! java code %> <jsp:declaration>java code</jsp:declaration>
- directives (executed at compile-time):
<%@ page attribute="value" %> <jsp:directive.page attribute="value" /> <%@ include file="url" %> <jsp:directive.include file="url" />
- attribute can be import, contentType, isThreadSafe, etc.
- actions (executed at run-time):
<jsp:include page="url" /> <jsp:forward page="url" /> <jsp:useBean id="name" class="bean_class" /> <jsp:getProperty name="..." property="... /> <jsp:setProperty name="..." property="..." value="..." param="..." /> <jsp:element name="..."> <jsp:attribute name="...> value </jsp:attribute> <jsp:body> body </jsp:body> </jsp:element>
- predifined objects:
- page -- is the same as this;
- pageContext;
- request and response -- the same as in normal servlets;
- session -- user session if available;
- application -- servlet.getServletConfig().getContext();
- config -- servlet.getServletConfig();
- etc.;
- tag libraries:
- taglib directive:
<%@ taglib prefix="my" uri="/my.dld" %>
- tag handler;
- tld -- tag library descriptor;
- translation and compilation process;
Assignment
[edit]Starting from the previous assignment, create a new web application that should use JSP instead of hand-written servlets.
Like the previous assignment this must be deployed on the Tomcat server under the name <username>-assignment-07 and also committed on the SVN server.
Reminder:
- assignment-05 required to implement a web application, using servlets, that allowed the user to manage a simple database, the records being kept inside a Java data structure (like ArrayList, HashMap, etc.);
- assignment-06 had the same requirements -- that is using servlets to ... -- but this time the records should be kept inside a relational database by using JDBC -- H2 was the database to be used;
- assignment-07 requires the replacement of the servlet with JSP pages, but the data still should be kept inside a relational database by using JDBC;
Ciprian Dorin Craciun, 2007-11-28, ccraciun@info.uvt.ro