Chapter 3. Hands-on MVC: Mini MVC Tutorial

image with no caption

Create and deploy an MVC web app. It’s time to get your hands dirty writing an HTML form, a servlet controller, a model (plain old Java class), an XML deployment descriptor, and a JSP view. Time to build it, deploy it, and test it. But first, you need to set up your development environment—a project directory structure that’s separate from your actual deployed app. Next, you need to set up your deployment environment following the servlet and JSP specs and Tomcat requirements. Then you’re ready to start writing, compiling, deploying, and running. True, this is a very small app we’re building. But there’s almost NO app that’s too small to use MVC. Because today’s small app is tomorrow’s dot-com success...

OBJECTIVES

Web Application Deployment

2.1

Construct the file and directory structure of a web application that may contain (a) static content, (b) JSP pages, (c) servlet classes, (d) the deployment descriptor, (e) tag libraries, (f) JAR files, and (g) Java class files. Describe how to protect resource files from HTTP access.

2.2

Describe the purpose and semantics for each of the following deployment descriptor elements: error-page, init-param, mime-mapping, servlet, servlet-class, servlet-mapping, servlet-name, and welcome-file.

2.3

Construct the correct structure for each of the following deployment descriptor elements: error-page, init-param, mime-mapping, ...

Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.