• Post Reply Bookmark Topic Watch Topic
  • New Topic

Themes and Skins  RSS feed

 
Aaron Roberts
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone tackled the area of themes and skins on their JSPs? I came across this offering and wondered if anyone had any experience with it?
xKins Home Page
Regards,
Aaron R>
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aaron,
You could probably do something pretty close to skins with the Struts Tiles framework. Have you looked into it? Or were you just looking for something that already existed that you didn't have to build yourself and could just use?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way I approached it is to use my own custom actions for including images and stylesheets on the pages. Depending upon the current "theme", these tags would resolve to files in alternative folders. I usually made it so that one theme could be declared the "default" theme and any file not found in the "current" theme would come from the default -- that way, files common across themes needn't be repeated.
 
Aaron Roberts
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just finished reading some stuff on Struts-Tiles. It certainly appears to be capable of doing what I'm thinking about.
I guess there are two types of theme-ing/skinning approaches.
1. If I am only going to be changing how things look (ie buttons, borders, colors)
2. If I want to do the above and move layout around.
For the first case, how far could using just a CSS go? I thought of maybe doing what you suggested Bear and having a dynamic include, say from a bean, as to what CSS or CSS set to use.
For the second, it seems like using Tiles or something similiar might be the best route. I think the biggest layout changes would be simply moving blocks of content around. IE Menu bar on the left/right/top. Would Tiles be a bit of an overkill?
Regards,
Aaron R>
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aaron,
If you had your JSP document write out a separate CSS link for each of your themes it seems that would work just fine for option 1. For option 2, I think Tiles would be your best bet. You would be able to put each of your "blocks" in separate JSP documents, and then create a separate template for each "skin". Since Tiles lets you move around blocks in separate templates, while reusing the "blocks", it would be a better fit that just creating custom actions for the "skinnable" portions as Bear said -- which is a good idea, but wouldn't let you move around blocks as you want.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

1. If I am only going to be changing how things look (ie buttons, borders, colors)
2. If I want to do the above and move layout around.

Both are easily accomplished with CSS. Personally, I wouldn't go the Struts route.
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a big fan of Struts, Bear?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if I were a Struts fan (which you have astutely surmised that I am not*), I wouldn't advocate adopting something that heavy just to achieve the ability to theme, when it can be done in a much more lightweight fashion.

* As you might gather from the other thread going on, I am a big fan of the Model 2 architecture. So it's not the idea of Struts that I have an issue with, just the implementation of that idea.
[ April 20, 2004: Message edited by: Bear Bibeault ]
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,
So are you saying that Tiles is too much for this example? Or Tiles is too big in general and there are always better solutions than its use? I'm only vaguely familiar with SiteMesh as an alternative, but really no others. (I've never used it, however.)
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So are you saying that Tiles is too much for this example?

In my opinion, yes. "Skinning" is easy to accomplish with a knowledge of CSS and just a handful of custom actions.
 
Aaron Roberts
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all the input. I've realized a bit earlier today that I'm starting to get too concerned with the 'right' way and may get nothing done, which would certainly be the wrong way.
I'm going to go study some more about EL and the difference between the JSP 1.2 and 2.0 spec. I think I have decided to not use Tiles for now, but I will keep it in mind and may play with it a bit, just for info sake.
Everyone's input is greatly appreciated!
Regards,
Aaron R>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!