4

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.

Basil Musa
  • 8,198
  • 6
  • 64
  • 63
  • Just curious why you are so against this approach. A file that uses XML syntax conforming to some schema is just another language for developing your application. There has been a general trend towards declaratively specifying application behavior rather than programming it and I think most people will recognize that as a good thing. Some people hate XML due to its verbosity, but it maintains its prominence due to the ease with which it can be used to design domain specific languages. – Konstantin Komissarchik Jan 31 '11 at 22:33
  • 2
    @Konstantin Komissarchik Never mind verbosity, the complete lack of compile time checking and having to traverse several files to find the relevant code are its biggest drawbacks. – biziclop Jan 31 '11 at 22:48
  • Yes, lack of proper tooling can be a problem with a DSL. Usually, framework writers focus their energies on the runtime and don't spend enough time improving tools/SDK. There is no underlying reason that a DSL couldn't have a solid build-time validation, refactoring support, etc. – Konstantin Komissarchik Jan 31 '11 at 23:19
  • Konstantin, thanks for elaborating. Compile time checking is the biggest problem. As well as having to read and understand the mind annoying XML schema. Even so, okay, if they insist on XML, at least provide both XML and API methods to do the same thing. I mean, in tiles, placing all the presentation layout in an XML file, Why? Why? Why? When it is possible to place it in a neat jsp file with the help of JSP Custom tags maybe. – Basil Musa Feb 01 '11 at 07:29

5 Answers5

1

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.)

Danny C
  • 2,980
  • 2
  • 28
  • 20
0

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.

Community
  • 1
  • 1
riddle_me_this
  • 8,575
  • 10
  • 55
  • 80
0

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.

Stephen Denne
  • 36,219
  • 10
  • 45
  • 60
0

Apache Tiles can be configured without using XML.

Stephen Denne
  • 36,219
  • 10
  • 45
  • 60
0

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.

Basil Musa
  • 8,198
  • 6
  • 64
  • 63