开发者

Apache Tiles like framework but with no xml configuration

开发者 https://www.devze.com 2023-02-07 23:51 出处:网络
Apache Tiles framework is great. But one thing I hate about it is the large xml configuration file that I have to maintain, even if partitioned, I just hate placing programmatic and presentation infor

Apache Tiles framework is great. But one thing I hate about it is the large xml configuration file that I have to maintain, even if partitioned, I just hate placing programmatic and presentation information inside configuration files.

I just don't get it? 开发者_开发知识库How did struts/tiles authors reach this obsessive tendency to place so much presentation logic inside configuration files?

I'm searching for a framework like Tiles but without the bloody XML configuration. Anyone can help in listing layout frameworks based on the Composite View model that compete with Tiles.


Sitemesh. Sitemesh is a similar system for templating pages but can be done without xml. This is especially nice if you have one or two main templates that you keep using over and over, no need to create an xml entry for each and every one. It's currently the default templating system in Grails. Sitemesh 3 has some nice additions but as of the time of this writing is stuck in beta with almost zero documentation. It uses the decorator pattern as seen in all of the comparison of tiles vs sitemesh.


Alternatively if you are willing to give up on jsp, you can give a go at JSF 2.0 which has very impressive templating capabilities with no xml needed. That along with the JSF component model for server side code will certainly assist in cutting down repetitive code. (As a bonus the Primefaces component library for JSF 2.0 is one of the most impressive component/widget sets around.)


Have you considered Apache Wicket?

With proper mark-up/logic separation, a POJO data model, and a refreshing lack of XML, Apache Wicket makes developing web-apps simple and enjoyable again. Swap the boilerplate, complex debugging and brittle code for powerful, reusable components written with plain Java and HTML.


Apache Tiles can be configured without using XML.


The layout tags provided by stripes are excellent. Require no configuration at all and easy to comprehend and start using. They are so great to an extent that I think they should be extracted from stripes and maintained as a separate project on there own github project space.


You can see a Tiles example with Java config (no XML) in this SO post.

The idea is to implement the DefinitionsFactory with a TilesDefinitionsConfig of your own and call tilesConfigurer.setDefinitionsFactoryClass(TilesDefinitionsConfig.class);. Your new config contains the layout definitions.

0

精彩评论

暂无评论...
验证码 换一张
取 消