I am working on a really simple framework for making it easier to plug
business objects into servlet logic.

One of the things we've talked about often on this list is the
difficulty of mapping a request/response phase onto business objects.

At the same time many of us don't mind some of the other restrictions
of the servlet API and feel that getting access to the request and
response and having control over the logic is a good thing and
therefore feel less inclined towards things like the web app
framework.

(I'm not knocking it Hendrik - it's a great product).

The tangle that I get myself into most is with trying to define ways
fro business objects to be turned into HTML not with the actual
servlet logic.

I have therefore been working on a very simple way of making business
objects extendable in a way that allows the servlet designer to
specify how the objects will be ouput.

I have come up with the webio package.

You can have a look at the status at:
http://www.tapsellferrier.co.uk/app-framework.html


How does it work?
It's really simple. There is a class called HtmlWriter which has
various print() methods which define how certain abstract objects are
printed.

We have some interfaces representing these abstract objects, eg:
List, Form, Link, etc... These define methods for passing back certain
data in a way that makes sense depending on the type.

For example Form objects must return information on their fields: the
field name, the field type and the field value.

whereas Link objects must simply return information about the text of
the link and target of the link.

I extend my business objects to implement the abstract definitions,
for example I might extend an Account object to implement Form and it
would return information about the account holder and the balance as
fields.

When I want to output the business object I simply print() it through
an HtmlWriter which gets the information from the object and sends it
out to the outputstream.


Why is this good?
Some other framework systems work by abstracting the HTML components
and allowing them to be instantiated as objects and have print methods
specified and so on. This increases the amount of objects being
created and lowers performance from the VM.

webio works well because it is possible for the servlet designer to
limit the amount of objects created during the servlet's life-time.
Many of the calls return Enumerations which simply pass references
between the business objects and the HtmlWriter. It's rather like
having a kind of filter for application data.


So What's the status?
It's not quite ready yet. It hasn't been tested at all. It is being
worked on in parallel with Paperclips (a FREE Java Servlet Server).

You can download the code from the link above to see how it's going
to work.

You can also download the code if you want to help out. It's a free
project so please come along and hurl abuse at the way it's written if
you like. Re-write as the best thing since sliced bread and you'll get
a credit on the web site.




Nic Ferrier
Tapsell-Ferrier Ltd
www.tapsellferrier.co.uk

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to