• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JSP Templating methodology

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm curious about different jsp templating implementations. I've decided that I don't want to go with a system like velocity or sitemesh. I want to do it using simple c:import's. There seems to be two schools of thought on this: do it like SSI's or do it like Smarty (the PHP templating system)

SSI:
Each page has the same structure and imports the common parts from other files.

Smarty:
You define what makes this page unique, then apply a template to it. dynamic stuff would be passed to the c:import via params.


I'm leaning towards the smarty approach for it's centralization. Any template changes only need to be made in 1 place.

Opinions?
 
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
3) Use JSP custom actions
 
Clifford Adams
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Care to expound a little?

What is the value in writing a custom tag library over using jstl?
 
Bear Bibeault
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using that technique, my pages tend to look like:



The <whatever:body> action is implemented via a JSP tag file that emits all the template stuff and embeds the page-specific content in the appropriate location.
 
Clifford Adams
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ahhh. I had completely forgotten about tag files.

//off to do some reading
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might take a look at struts:tiles.
Why re-invent the wheel?
 
Bear Bibeault
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Stefan Evans:
Why re-invent the wheel?



To me, adopting tiles just to do simple templating is bit like using



when all you need is a wheel.
 
Clifford Adams
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've looked at tiles, but it doesn't do anything c:import can't

the tag files look nice and flexible.

thanks.
 
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic