SiteMesh 3 Taglib

4,933 views
Skip to first unread message

Corrado Alesso

unread,
Sep 18, 2011, 12:53:31 PM9/18/11
to SiteMesh 3 Users
Hello everyone, I'm an avid user of sitemesh 2, I've jsut discovered
sitemesh 3 and I want to give it a try on a real project even if it's
alpha...

But I have a problem with the tag library definition.

In sitemesh 2 I had
<%@ taglib prefix="decorator" uri="http://www.opensymphony.com/
sitemesh/decorator" %>

Where is the taglib for SM3? Obiouvlsy I get errors at all
<sitemesh:*> tags...

Thanks, I'd really love to contribute some code to this awesome
project, SM is the way to go.

Corrado Alesso

unread,
Sep 21, 2011, 5:17:14 AM9/21/11
to SiteMesh 3 Users
Anyone has any idea about this one? Also pointers to docs... I really
would like to use it officially in my projects but really can't stand
all those yellow marks everywhere because the taglib is not found..


2011/9/18 Corrado Alesso <oda...@gmail.com>:

Jeff Jensen

unread,
Sep 21, 2011, 8:05:10 AM9/21/11
to sitemes...@googlegroups.com
I don't know if one exists... we didn't use one.  I suggest you check source for one.  I agree - would be great to eliminate the validation warnings!! (and it's helpful to use it to learn the tags!)

Corrado Alesso

unread,
Sep 21, 2011, 8:25:17 AM9/21/11
to sitemes...@googlegroups.com
Both in the bin and the src jar, there is not a tag library
descriptor... I can understand if this is a "to do later" feature.


2011/9/21 Jeff Jensen <jje...@apache.org>:

Joe Walnes

unread,
Sep 21, 2011, 8:45:39 AM9/21/11
to sitemes...@googlegroups.com
SM3 is not tied to JSP and therefore has no taglib.

However, I'm not against adding a taglib to make it easier for JSP users, if anyone wants to contribute this.

-j

Jeff Jensen

unread,
Sep 21, 2011, 8:47:37 AM9/21/11
to sitemes...@googlegroups.com
Does a "list" of the valid tags exist anywhere?

Corrado Alesso

unread,
Sep 21, 2011, 8:49:00 AM9/21/11
to sitemes...@googlegroups.com
Perfectly reasonable.

I will see what I can come out with.


2011/9/21 Joe Walnes <j...@walnes.com>:

phamti

unread,
Sep 21, 2011, 9:06:31 AM9/21/11
to SiteMesh 3 Users
Hi Corrado,

As I understand it from reading http://www.sitemesh.org/new-in-sitemesh3.html
SiteMesh 3 works differently in that the SiteMesh tags are not jsp
technology specific. The application will run just fine with the
"warnings".

That's why in the example application code sitemesh-examples-
hellowebapp.war the decorator is actually an html file. I think the
aim of this approach is to allow a more "separation of duty" approach
where the Front-End developers who use tools like DreamWeaver can work
on the decorator using their GUI tools and not having to learn JSP.

Your point though is valid though because JSP programmers could
certainly use the tag libs auto-complete feature and the choice of
decorator like tags will cause "warning" in most java editors like
Eclipse even for html pages. In DreamWeaver I don't see errors, but
DreamWeaver does not play nicely with the tags when I use the GUI.

Perhaps, we can persuade the development team to consider a more
editor friendly approach, that is using custom defined divs that will
not break jsp, still work with the GUI in DreamWeaver and be W3C
valid, for examples,

<sitemesh:write property='body'>Body goes here. Blah blah blah.</
sitemesh:write>

Could be,

<div id="siteMesh" class="write.property.body">Body goes here. Blah
blah blah.</div>

Tin

Corrado Alesso

unread,
Sep 22, 2011, 6:04:10 AM9/22/11
to sitemes...@googlegroups.com
Sorry for the late reply.

Yes the application runs fine, my pages get decorated of course. It's
just annoying to have warnings. I don't know if I would prefer a
regular "div" as sitemesh's tag. Custom tags just "stand out" more.
Tools support is probably the road I would follow, that is including
what a given technology needs to run well in standard environments.
For JSPs of course this is a taglib definition.

I will take a look at this during the weekend, in the meantime, as
already said, a "list" of supported tags may be very useful, lowering
possibilities to miss something reading the source code.


2011/9/21 phamti <tin....@gmail.com>:

Corrado Alesso

unread,
Sep 22, 2011, 8:23:51 AM9/22/11
to sitemes...@googlegroups.com
I still have to dive into this, but I've already thought of a potential problem.

Jsp taglibs require a <tag-class> tag to describe the class
implementing the custom tag. SiteMesh's tags are not implemented as
standard Jsp tags, so this will probably fail.

2011/9/22 Corrado Alesso <co.a...@fastwebnet.it>:

Joe Walnes

unread,
Sep 22, 2011, 4:19:49 PM9/22/11
to sitemes...@googlegroups.com
You could implement JSP tags that simply echo themselves back out again. Basically, they do thing (which the SM filter will then post-process).

Corrado Alesso

unread,
Sep 23, 2011, 1:47:28 PM9/23/11
to sitemes...@googlegroups.com
I will follow this advice, this evening I'll probably have some time.

Can anybody confirm that at the moment there are just two tags to
support, <sitemesh:write> and <sitemesh:decorate> ?

2011/9/22 Joe Walnes <j...@walnes.com>:

Joe Walnes

unread,
Sep 23, 2011, 3:20:55 PM9/23/11
to sitemes...@googlegroups.com
Correct. Specifically....

<sitemesh:write property="....">....</sitemesh:write>
* property (required) is the key of the value to write
* the (optional) body of the tag will be removed. This is useful for testing your HTML when SM is not enabled and you want to see a placeholder such as 'The title will go here'

<sitemesh:decorator decorator="/some/dec" key1="value1" key2="value2"... >....</sitemesh:decorator>
* decorator (required) is the path of the decorator to apply
* the other (optional) attributes are arbitrary keys/values that can be passed to the decorator. I'm not sure if this can be supported in JSP taglibs.
* the (optional) body of the tag is the equivalent of specifying a body attribute

Code is here for reference:
Reply all
Reply to author
Forward
0 new messages