The world enjoys the simplicity of HTML: simple text with formatting information. WWW made up horribly ugly things such as Microsoft's RTF format, for example, will be quite unthinkable. Web applications are rarely anything more than a few simple widgets on pages with a submit button. The software development world has since then tried various approaches in handling web applications.
Static HTML is not so programmable, so we have ASP or JSP to intermix it with code to generate dynamic HTML. If you allow people to write sloppy code, they'll do it. I have seen a lot of code where JSP/ASP intermix with data accessing routines and business rules routines, resulting in hard to follow and maintain code. The solution for that of course, is the important Model-View-Controller pattern to separate presentation, logic, and data.
Ever since, people try to associate a JSP with a "controller" file. Ever since, people try to come up with a good way to handle the action attribute of each <form> tag.
This is where frameworks come in. You can write your own, of course, or employ a favorite well known framework. The most popular frameworks for Java are of course Struts and Spring. Both sounds like important foundational elements of your car. Hmm, perhaps the next framework may be named "tires" or even "engine".
Both frameworks work by adding a section in web.xml to reroute files with certain extension such as *.do to be handled by the framework servlet, and provide some configuration file to link the JSP and the controller classes together. The controller is responsible to do work and retrieve data, to be toss back to the JSP for "view" purpose. Each framework has its own hard-to-manage-by-hand XML configuration file.
Struts is action oriented. It treats each thing happening to your web page is an action: loading, saving, submit button clicked, etc. The newest buzz is being to able to use POJO (Plain Old Java Object). Ok, POJO is a wacky acronym. It comes with a full set of custom tag libraries.
Spring is not just MVC, have a lot more things, such as buzzword Aspect Oriented Programming. This seems to outshadow Struts and even EJB. The examples I've seen encourage overriding *.htm so that we don't show what technology we are using such as .asp, .jsp, or .do. It promotes itself with Hibernate: an attempt to add object orientation to good old relational database. That's ORM: object relational db management. But is ORM really a good thing? How do you freely perform your own query? I don't mind plain old JDBC. Spring encourages the JSTL tags.
Theoretically, the Spring IDE for Eclipse is supposed to make everything easy, but who do you go to when you see an install error?
Both frameworks offer validation routines that may take a while to get used to. Both requires XML configurations, and a learning curve, and programmer discipline to write good code. Document all over please, it is already hard to follow an easy sample program.
No comments:
Post a Comment