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, servlet, servlet-class, servlet-name, and welcome-file.

Coverage Notes:

All of the objectives in this section are covered completely in the Deployment chapter; this is just a first look. This chapter is the only complete start-to-finish tutorial in the book, so if you skip it, you might have trouble later testing some of the other examples in later chapters (where we don’t go through every detail again).

As with the previous two chapters, you don’t need to focus on memorizing the content in this chapter. Just get in there and do it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset