-1

I'd like to pack up presentation aspects of an application in a modular way; if I have a set of functionality in a separate JAR project, I'd like to keep UI elements related to that aspect separate from the core webapp code.

I think that tag libraries were the way to do this, so a lib could contain a bunch of classes implementing special interfaces and a descriptor. Then, the only footprint that the modular piece has would be one/more tags. Ideally, I'd like to avoid a runtime dependency on some specific modular piece being there... not sure how to achieve that!

Are tag libraries still the way to go? Or are there better options?

Charles
  • 50,943
  • 13
  • 104
  • 142
brabster
  • 42,504
  • 27
  • 146
  • 186

2 Answers2

1

No, I wouldn't say so. The temptation to embed logic into those tags is too great. It locks too much stuff in the UI where it doesn't belong. How will that play when you need a mobile or tablet UI?

The only tag libraries you should need are JSTL.

JSF is a failure. I'd steer clear of that.

I would say that you're better off keeping your view layer as slim and simple as possible. Base it on HTML, CSS, and JavaScript. Put all the logic in services that are reusable and more likely to stick around as UIs come and go.

I use Velocity templates to generate HTML and map dynamic data from Spring models. I wouldn't use JSP or JSF unless forced to.

duffymo
  • 305,152
  • 44
  • 369
  • 561
  • The market doesn't lie. JSF is a bloated, heavyweight extension of Struts that has been passed by. HTML, CSS, JavaScript, and jQuery are what people should be using. – duffymo Nov 23 '11 at 12:38
0

Since JSF is the latest view technology du jour in java world and it encourages creation of taglibs, I'd say they're here to stay for a while

soulcheck
  • 36,297
  • 6
  • 91
  • 90