Why I would want to follows:
I'm worki开发者_如何学Pythonng on a site that is pretty 1998. It's distributed into frames. A lot of hands that never RTFM'd before using the templating language have touched it and most of the jhtml files read more like lists of servlets with a dash of logic than HTML templates with a dash of templating tags for dynamic repetition of elements and insertions of dynamic values.
It's a pretty inflexible tightly coupled spaghetti monster of an app, especially from a front end dev's perspective.
I'm very fond of Django's approach to the problem and would like to take a crack at building something like it's URI config file which basically maps regEx URI patterns to controllers (passing in captured parameters is where that gets really useful) which in turn load up template files and plugs in the business logic to render the appropriate page.
I'm new to Java but I'm assuming I'd be writing servlets to handle this.
We've done something slightly like this in ATG. We put a servlet in the pipeline that does request.getServletPath(), then checks that path against our rules. If it matches, it uses a request dispatcher to send the request to the right JSP. It's all done with the standard J2EE API, apart from the fact that it's in the ATG request pipeline.
Since you mention ATG 5 and JHTML, I assume this is very old-school ATG. Also, you I assume you are VERY new to ATG.
You may want to start by exploring JHTML's use of droplets to include other pages (<droplet src="..."> instead of <droplet bean="..."> - something that is only in JHTML, not in ATG's JSP implementation), to put together a crude templating system for existing pages.
Secondly you may want to look at the URI-mapped servlets and the servlet pipeline.
精彩评论