• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Templating methodology

 
Clifford Adams
Ranch Hand
Posts: 50
  • 0
  • 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?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
3) Use JSP custom actions
 
Clifford Adams
Ranch Hand
Posts: 50
  • 0
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ahhh. I had completely forgotten about tag files.

//off to do some reading
 
Stefan Evans
Bartender
Posts: 1640
9
  • 0
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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
  • 0
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic