Hello everybody. I am doing a project that requires me to implement a simple Model-View-Controller on my web server that uses Tomcat 5.5. The files that I am using are the ControllerServlet class, PersonBean class, and two jsp files hello.jsp and goodbye.jsp. The MVC we are supposed to implement is the one on this webpage:http://www.informit.com/guides/content.aspx?g=java&seqNum=117
I have already compiled my classes but now do not know where to upload all of these files on my web server. The two class files are in the package com.informit.webtechnologies. I have tried contacting my professor and fellow classmates and nobody has gotten their MVC to work yet. I am completely new to this and am taking my first web design class, which at our school gives us a week to learn each language. I would appreciate anyone who can simplify this process for me. Thanks
Just to be pedantic, I'm going to point out that "true" MVC is impossible on any web-based system. That's because one of the things an actual MVC system has to have is the ability for the controller to post updates to the View when the Model changes. HTTP is strictly a Request/Response protocol and has no ability to asynchronously notify the client (browser) if the Model is changed between requests. The best that can be done is to include those changes with the next Response. This failing can be reduced by using AJAX to poll for changes, but it's still not going to result in a 100% pure MVC. There will always be quantum discontinuities.
However, in the real world, we're happy with "close enough". Several attempts were made over the last decade or so to get as much of the benefit of MVC as possible. One of the more successful ones was the development of the JavaServer Faces framework. Although it can't do anything about HTTP's limitations, and there is a small amount of co-mingling of code between Model and Controller, JSF has indeed proven "close enough".
An IDE is no substitute for an Intelligent Developer.
I'm surprised that your professor jumped straight to MVC before having the class write some simple hello world apps to get people familiar with the file structure of a Java web application. You might want to look around for some web tutorials or books on servlet programming to make sure you get all the fundamentals down before moving on to things like this.
We have some tutorials in our Cattle Drive. There is a servlet section there and it covers MVC.
We also have some example applications in our CodeBarn. The servlet applications are packaged as war files so they can be download and dropped into your tomcat/webapps directory. Once in there Tomcat will automatically unpack them and deploy them. There is an MVC app there as well.
If you download and deploy that, you'll have a running copy of an MVC app (with code) that you can use to compare with the one from the link you posted.
Active MVC relies on a 2-way asynchonous message flow. Passive MVC relies on the Observer Pattern, which, as they mentioned, is the best you can do using HTTP as a transport mechanism.
MVC was not considered as a formal "Design Pattern" in the seminal GoF book, but rather as an assembly of alternative Design Patterns. They declined to define a term for such assemblies, however. Missed opportunity.