This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I wanted to post this because I searched for an answer to this over 2 years ago and didn't find one. I just search today and didn't either. I found two old postings on the JavaRanch from back in 2007 and neither of them had what I would call an elegant solution. I think I finally have a pseudo-elegant solution and I want to see if anyone can poke holes in it.
Here is the template:
Here is my test html. I did not do portlet code because we are using this "design" already in production so that is tested out.
Once I have it out in a js file I can also minify it which is something I could not do if I went the include jsp route. This solution also addresses an issue a developer is having here in that a compiled JSP exceeded some size limit. I won't go into the whole design of the page since it could be argued it is too big but being able to remove the JS will help solve that for him. If we did an include JSP mechanism it still would have been part of the compiled page.