Something about J2EE MVC structure - updated in 23/07 To be cont

打印 被阅读次数

Web Development in J2EE Using the MVC Design Pattern - Applying the Model/View/Controller Design Pattern

The view interface presents us with a wide range of options such as making a selection from a series of radio buttons or a drop down list. For example, the user can select the type of delivery service, i.e. UPS, FedEx, USPS, or DHL from the list. Traditionally, the view is presented in HTML format. However, an interface may be also presented as XHTML or XML/ XSLT templates. Because the view is display-neutral, it can present many diverse views of the same data. A view always reflects any event changes occurring in the “model” layer.

The model contains business objects which interact directly with JavaBeans or Enterprise JavaBeans (EJBs). They implement transactional business rules such as data persistence or retrieval.

The Controller serves as interpreter by intercepting client requests and calling a servlet’s service() function to fulfill the client’s request. The controller applies no formatting nor does it output anything. It serves only as a notification service both to the view and model to respond accordingly.

***********
Create New BusinessAPI Bean
 
 Input: -       Application   Name
           - Domain        Name 
 Output:/xxx//API/BusinessAPIBean.java 

For example:
/xxx/ecommerce/letters/lmm/api/letterRequest
APP: ecommerce/letters/lmm/
DOMAIN: letterRequest

***************************
Updated 23/07/2007
How to remotely debug a J2EE applicaiton:
Here is link to show you debug j2ee applicaiton with Jboss application server and eclipse IDE.
http://www.onjava.com/pub/a/onjava/2005/08/31/eclipse-jboss-remote-debug.html

In our system, we use following parameter for debuger, so we will change the port number.
DEBUG_ARGS=" -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=18699,server=y,suspend=n"

***************************
Updated 23/07/2007
Some main support points of our CRM system:

Interaction.java - the controller to handle http requests

WebProxy.java - the delegater to coordinate different tasks to different EJB(Session Bean) by calling home factory. The home factory is a collection of all ejb home interfaces.They use context to lookup JNDI directory and locate local home object. Then creates the object and calls remote ejb interface's methods. It is equivallent to call EJB Bean's methods. Our CRM system is pretty shitty. It does not use Entity Bean, instead, it uses JDBC to directly access DB and fetch the data. Crap!

main.jsp - Start and return point of each main request from view.

Logger.java - I am surprised that we did not use native weblogic logger. Instead, we created our own logger to record system events. Stupid!


***************************
Updated 23/07/2007
To be fixed
java basics
exception handling
Serializable? For http request stream?
HTML form

登录后才可评论.