Hi,
I have for some time been studying web architecture using the Java Framework (serlvets, jsp, beans,xml,xslt). Well, in theory I have a pretty good understanding of the concept. However, when I started to develop a small simple application I came across a number of design issues related to “what is good programming” and also the principle of OO thinking.
Let’s say a user sending html requests to a dispatcher (servlet) which then is suppose to redirect the request to a “GenerateDOM” bean.
The “GenerateDOM” bean is supposed to fulfil the request by retrieving the requested data from a database(JDBC). The “GenerateDOM” bean has a predefined Customer XML DOM structure and return the DOM object to the dispatcher that then send data back to the client.
If we only focus on the “GenereteDOM” bean I can easily see that problems arise when the user requests info that require other XML structures (such as Parts, Suppliers, Orders, shipping etc). I can see that the number of “GenerateDOM specific beans” is going to increase significantly. Well, with a “limited” knowledge of XML and Java, I’m wondering if there is a better way of utilising the concept of OO and technology when designing a system like this?
In my “ideal” world I am thinking about a solution where I have a generic GenerateDOM for all requests. So, in other words, when a user request for example all orders the “GenerateDOM” bean should read an XML Schema (maybe use of DTD? or something else) that the DOM tree apply and build an XML structure of and populate the structure with data from the DB.
I don’t know what is the “best practice” for handling situations like this.
If anyone has ideas I would be very thankful for any suggestions
Regards
Erik
I have for some time been studying web architecture using the Java Framework (serlvets, jsp, beans,xml,xslt). Well, in theory I have a pretty good understanding of the concept. However, when I started to develop a small simple application I came across a number of design issues related to “what is good programming” and also the principle of OO thinking.
Let’s say a user sending html requests to a dispatcher (servlet) which then is suppose to redirect the request to a “GenerateDOM” bean.
The “GenerateDOM” bean is supposed to fulfil the request by retrieving the requested data from a database(JDBC). The “GenerateDOM” bean has a predefined Customer XML DOM structure and return the DOM object to the dispatcher that then send data back to the client.
If we only focus on the “GenereteDOM” bean I can easily see that problems arise when the user requests info that require other XML structures (such as Parts, Suppliers, Orders, shipping etc). I can see that the number of “GenerateDOM specific beans” is going to increase significantly. Well, with a “limited” knowledge of XML and Java, I’m wondering if there is a better way of utilising the concept of OO and technology when designing a system like this?
In my “ideal” world I am thinking about a solution where I have a generic GenerateDOM for all requests. So, in other words, when a user request for example all orders the “GenerateDOM” bean should read an XML Schema (maybe use of DTD? or something else) that the DOM tree apply and build an XML structure of and populate the structure with data from the DB.
I don’t know what is the “best practice” for handling situations like this.
If anyone has ideas I would be very thankful for any suggestions
Regards
Erik