aspose file tools*
The moose likes JSP and the fly likes Jakarta Taglib project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Jakarta Taglib project" Watch "Jakarta Taglib project" New topic
Author

Jakarta Taglib project

Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
does anyone use Jakarta taglib in real world applications? I have the impression that their flow control and database access tags are too generic and therefore hard to use for non-programmers.
But the whole point of custom tags is to allow non-programmers to use them. Does anyone have any thoughts?


Seam Framework: http://www.amazon.com/exec/obidos/ASIN/0137129394/mobileenterpr-20/
Ringful: http://www.ringful.com/
Rick Salsa
Ranch Hand

Joined: Jul 17, 2001
Posts: 173
Originally posted by Michael Yuan:
But the whole point of custom tags is to allow non-programmers to use them. Does anyone have any thoughts?

I agree with you. That was the point of tag libs, and I think that some developers have forgotten that, or most of them don't work with web designers, they do all the web work. If you're looking for a nice tag lib, take a look at
WebWork. It's a whole framework similar to Struts. The ideas behind the tag libraries are excellent!! Also very easy to use and understand. It was designed with the goal stated above, make it so that web designers can use it as well. Granted, the tag in the tag lib can get complicated, but I see those only being used in certain cases.
/rick
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

I believe that Sun has announced that a standard taglib is under development. Don't be surprised if Sun and the Jakarta taglib project have some convergence - Sun's been working quite a lot with Jakarta lately.
The Struts taglib folks are trying to come in somewhere here as well, just to keep from producing too many similar-but-not-identical tag products.
Personally, I'm a little leery of DBMS tags - that's really a 2-tier solution and ASP has shown me some really awful examples of 2-tier architecture.


Customer surveys are for companies who didn't pay proper attention to begin with.
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Sorry, just seen this thread and thought that it was interesting...
Originally posted by Michael Yuan:
But the whole point of custom tags is to allow non-programmers to use them. Does anyone have any thoughts?

I also agree with you and one of the important things that tag developers can do is to think of their target audience.
What I've generally found is that on larger projects we've generally had somebody helping out with the look and feel of the web application and it's these people that don't want to be seeing checks for null and the inner workings of "for" loops.
We (as developers) are used to writing logic as a series of small steps - after all, that's what programming is all about. However, for the other people involved in a project, it probably doesn't make much sense. Custom tags certainly can help these sorts of problems but often, as you say, they are too generic or they simply mirror those small steps that are required to perform the larger piece of logic making them harder for non-programmers to use. Part of the trick to writing good tags is to make sure that they are adequately abstracted away from the underlying functionality that you are trying to provide. A good way to do this is to make them fairly coarse-grained.
Of course, there are times when only developers are involved in authoring the pages, and in this case you can get away with making the tags slightly more fine-grained.
Just my 2 pence...
Simon
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Originally posted by Tim Holloway:
I believe that Sun has announced that a standard taglib is under development. Don't be surprised if Sun and the Jakarta taglib project have some convergence - Sun's been working quite a lot with Jakarta lately.

You are probably talking about Jakarta's "Standard" Taglib - JSR 52 "Standard Tag Library" reference mplementation.
Originally posted by Simon Brown:
We (as developers) are used to writing logic as a series of small steps - after all, that's what programming is all about. However, for the other people involved in a project, it probably doesn't make much sense. Custom tags certainly can help these sorts of problems but often, as you say, they are too generic or they simply mirror those small steps that are required to perform the larger piece of logic making them harder for non-programmers to use.


Martin Fowler holds a radical view on "how much logic in presentation is Ok" and recommends to "keep all the logic out of the page" and to use specialized tags instead. So
<IF expression = "isHighSelling()"><B></IF><property name = "price"/><IF expression = "isHighSelling()"></B></IF>
would be
<highlight condition = "isHighSelling" style = "bold"><property name = "price"/></highlight>
But this way a big site can end up with hundreds of specialized tags! There is an interesting project, "taglibs with XSLT", and the author says his template language is about 200 instructions. The question is: what is easier, to learn all these 200 "declarative" tags or to have a dozen "logic" tags (which should express logic of presentation, not logic of application, of course) and to learn how to manipulate them. For me the second variant is better, and it has additional advantage that a designer doesn't have to ask a programmer to write a new tag every time s/he need to achieve something slightly different.
The REST architecture was a success for similar reasons.
Fortunately, JSTL creators introduced selection and looping tags in their library
[ April 17, 2002: Message edited by: Mapraputa Is ]

Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Originally posted by Mapraputa Is:
Martin Fowler holds a radical view on "how much logic in presentation is Ok" and recommends to "keep all the logic out of the page" and to use specialized tags instead.

That is quite radical and (IMHO) it's a tall order to remove every piece of logic out of a page. I agree with you Map - I tend to prefer the "simple is better" approach otherwise there's the danger that you start inventing a new programming language.
Presentation logic is good, but it should (from a maintainability perspective) be restricted to "should this be displayed?", "how should this be displayed?" and so on.
Of course, as well as the audience of the library, there's another factor that can affect the granularity of the tags - the architecture of the web application. For example, on the whole, the tags built and used on a model 1 architecture will probably perform more logic than those that are used on a model 2 app, simply because there is additional required functionality such as retreiving information and so on.
Hmmm ... an interesting topic.
Jim Petersen
Ranch Hand

Joined: Jul 24, 2001
Posts: 241
Hi Simon
Looking forward to browsing your book for another perspective on taglibs once its out on the shelves... perhaps you may want to oraganise with Wrox a few giveaways here...


- Jim Petersen <br />SCJP2<br />SCWCD<p>- but then again, I could be wrong...
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
I'm sure that we can sort something out if we ask them nicely enough.
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
There is another perspective: how well the tags will be integrated with HTML, in particular how they will be shown by HTML editors? If it isn't an integrated environment with JSP support, how will Martin Fowler's <highlight> tag look like? Most likely it will be simply ignored.
With "logical" tags, we still can have an adequate picture. I used concocted syntax, but close enough. DreamWeaver 4.0. was able to show a meaningful picture. (screenshot) So did IE. Maybe this is a periferal and rather aesthetic issue, but it feels good if JSP tags do not break visual layout. I do not see how we can achieve this without "generic", "logical", "programmer-oriented" tags.
[ April 17, 2002: Message edited by: Mapraputa Is ]
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
That's another very good point, although the tools are slowly getting better and better. I was having a chat with somebody about one of the new breed of tools that actually sends the page to Tomcat and presents the results in a WYSIWYG fashion.
Now that sounds cool. Can't remember which one it was - might have been UltraDev.
Simon
Jim Petersen
Ranch Hand

Joined: Jul 24, 2001
Posts: 241
Another spin on using taglibs...
I recently got involved in a project where an app had been built in a page-centric with little thought to the consequences. When I was brought on board the project manager showed me round the app - literally 000s of jsps with 000s of lines of code! (I thought to my self "well you can't make this an any bigger mess... "). The PM then told me the role was "1/2 refactoring and 1/2 trouble shooting" (again another mental note: it looked like I'd be 70% trouble shooting on this - and most of this would be finding the bug let alone fixing it) plus he added oh we can't take down the app cause it sort of works ok...
It is a small team (admittedly working on an app thats got away ) and every one has got an idea about java. Here taglibs have proven to be a quick (if part) solution in at least making the jsps manageable and giving specific parts of the app a place to live!
As we don't have the luxury of time and resources of rearchitecting the app (that would probably mean starting from scratch!), at this stage at least its now 2 steps forward, 1 step back. Sometimes a quick 'n dirty interim solution goes someway here so at we can buy some time into concieving a better app design...
just my 2p
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Originally posted by Simon Brown:
I tend to prefer the "simple is better" approach otherwise there's the danger that you start inventing a new programming language.

This is another very interesting point!
In fact, tags do constitute a language, whether we call it so or not. Syntax of this language is "fixed" and defined by JSP Tag syntax, but semantics is up to programmer. From this semantic point of view tags probably belong to the class of domain-specific languages. Now, how many developers have skills of a language designer? And I do not know any book that teaches these skills to the developer of reasonable intelligence (this doesn't mean there is no such book, only that I am unaware of it).
So from one perspective, tags are "normal" programs, from another, they are elements of a language, from yet another they are a part of visual layout. The task of designing a good tag library ask for a talent of Leonardo da Vinci! :roll:
This is too interesting discussion, maybe it should be moved to JSP forum? To collect more opinions. We can always bring it back later.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
One of the dilemmas I encounter all the time when using custom tags is the "who owns the HTML" paradox. let's look at three typical but hypothetical solutions to a similar problem:



The first is just what the page designer asks for. It's simple, expresses the intenttion, and needs no programming knowledge.
The second is more complicated, but still just about understandable. Although it has a few "gotchas" and really needs an understanding of the quirks of tag-instance cacheing to avoid bizarre bugs.
The third is almost a re-coding of the equivalent Java into a strange XML hybrid.
If you've worked with custom tags you've more than likely come across all of these types and more. But all of them are ultimately frustrating to the page designers, who need to quickly make a "really simple" change such as adding a "valign='top'" attribute to all the table elements, or changing the background colour of the header.
The first approach means that for every small change the page designers must go cap-in-hand to the tag programmers and wait until they see fit to release a new tag with the changed HTML. And all the tables in the project must look the same.
The second approach is the sort of mucky hybrid that you get after the tag programmers have begun to get fed up with being pestered to make and then rewind lots of fiddling changes. But every time a reworked tag structure is produced, all the pages have to be redesigned to use it, and it is still unlikely to provide the flexibility for the next "really simple change".
The third approach represents the tag programmers having a meeting and washing their hands of the whole issue. They hope that by providing "complete flexibility", those *#%?@* page designers will finally get off their case. Instead, the page designers now can't do anything without someone skilled in both Java and the wacky tag language they have invented continually on call. And such a person rapidly becomes hard to find!
Sound familiar ?
The only way through this that I have found so far is to merge the ideas of custom tags and templating. In the case above we might have something like:

where books.tpl might look like

books-row.tpl might look like

This goes much further toward giving control of the HTML back to the page designer, who can use whatever tools he/she likes to generate these micro-templates. It also means that the Java developers can make the sort of general support framework we are good at, then move on to another interesting project.
Does this make sense? Have I missed something obvious?
(Map edited long lines in CODE tag)
[ April 24, 2002: Message edited by: Mapraputa Is ]

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Jim Petersen
Ranch Hand

Joined: Jul 24, 2001
Posts: 241
Originally posted by Mapraputa Is:

...This is too interesting discussion, maybe it should be moved to JSP forum? To collect more opinions. We can always bring it back later.

Map you've got the power! Do it!
It would be interesting to get some more views... It has been very interesting and thought provoking given the explosion in taglib lib development over at Apache. What I'm taking from this is beware of apparently 'simple', 'out-of-the-box' solutions... and the potential knock-ons for later development/maintenance ...possibly a move to the servlet forum as well??
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Originally posted by Frank Carver:
Sound familiar ?

Certainly does.
It all comes back to the audience of your tags - who they are, how much Java experience they have, how much control of the HTML they need, etc.
The real hard bit is balancing keeping the page designers happy. In fact, it's not only about keeping them happy, keeping the presentation out of the tags is a good thing - otherwise you're constantly recompiling tags to make changes to the look and feel. Basically, it's the old "HTML in Servlets" scenario. :roll:
Of course there are times when you just can't get away from including some HTML inside your tags, but atleast there are some strategies to reduce the impact this has on the maintainability of the look and feel.
The templating stuff is great - have you seen the new JSP 1.3 features? One of them allows you to build "tags" that are essentially small fragments of JSP.
So, who has "the power"?
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
who has "the power" ???
See - it is not my fault! I was provoked! Moved to JSP forum.
 
 
subject: Jakarta Taglib project