To install the MVC application on the server, start by placing the view JSP, view.jsp, in the chap16 folder on the server:
chap16 view.jsp |____WEB-INF |____classes |____beans
Next, place Model.java in the classes\beans directory and compile it there to create Model.class this way:
chap16 view.jsp |____WEB-INF |____classes |____beans Model.class
To compile the Controller servlet, you set the classpath so that Java can find servlet.jar (or servlet-api.jar, depending on your version of Tomcat) as well as the Model.class file in the beans directory. To do this, place the servlet’s Java code, Controller.java, in the classes directory, and copy servlet.jar (or servlet-api.jar) to the classes directory as well. Then set the classpath to servlet.jar;. on the command line:
The dot on the end of the classpath means that Java should include the current directory, and tells Java that when it’s looking for the beans.Model class to try to find a directory named beans that contains a class named Model. After you compile Controller.java in the classes directory, you’ll have Controller.class in the same directory, which is where you need it:
chap16 view.jsp |____WEB-INF |____classes Controller.class |____beans Model.class
That sets up the code on the server. Now it’s time to call that code from the browser.