Hi Drew,
have a look at www.webapp.de. The package SMI ( Servlet Method Invocation )
does what you want and a lot more.
It's free for noncommercial use and you can get the SourceCode.
The Webpages correspond to a really good german book named 'Java Server und
Servlets'.
It contains additionally to SMI a Servlet Engine, a Persistence Framework
and more.
It's worth lookking at it. The book is translated into english actually and
should arise soon on the market.
Hope this helps.
If you want to know my opinion: It's exactly the right way to map class and
method to a webaction. I work for myself with a similar architecture and
like it very much. The limitation to one method per class with a defined
name and defined parameters does not make sense to me.
Regards,
Wolfgang
-----Urspr�ngliche Nachricht-----
Von: Drew Cox [mailto:[EMAIL PROTECTED]]
Gesendet am: Mittwoch, 12. Januar 2000 05:54
An: [EMAIL PROTECTED]
Betreff: How to dispatch web actions from servlet to dynamically named
bea n class.method ?
I have been following with interest over the last few months the various
threads on web app architecture. I am currently working on a small
servlet/JSP system and using a version of the single controlling servlet
model that has been discussed quite a bit. I have an implementation
question.
I like the idea proposed by some people that the configuration of the web
actions be stored in a HashTable, which is loaded on application a startup
from a properties file or a database. This allows the developer to avoid
hard-coding the following relationships:
1) The web "action" requested in the HTTP request, eg. URI
/controller/getClient
2) The class that the controlling servlet uses to processes the web action,
eg. Barrack.JspBeans.ClientGetter.
3) The JSP page the bean or servlet then forwards to, to display the
required output, eg. URI /display/showClient.jsp
It seems common to implement the Command pattern in the processing class (#2
above), so the controlling servlet can simply call a "doAction(request,
response)" method on the class, without knowing anything about it. All
makes sense so far...
So, finally, on to my question.
What if you would prefer to be able to configure both the class and a
specific method name that each web action maps to? Is there and easy way
call a dynamically named method on a dynamically named class? I guess this
is more of a generic Java question now, sorry. I suspect that there are
things in the Reflection API that allow this, this is where I am heading
next.
The reason for this is that otherwise I have to create a separate class for
each action. I would really prefer to group some of these action processing
methods together into a single class. This is both to keep things tidy (?)
and to to store some state information in that bean from one method call to
the next (the class would be stored in the session).
This is for things like implementing a multi-page workflow where the bean
could then check it's internal state to ensure the pages are being completed
in the correct order, or what the previous page should be if the user want
to go "back". It also seems a little closer to my limited understanding of
EJB Session Beans, which I believe implement the various actions that can be
performed as separate methods (??).
I'm interested in any opinions people have on (a) how to implement this and
(b) if they don't think it's a good idea, why.
Regards
Drew Cox
Barrack Consulting
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html