JMesa Tag Library Discussion

136 views
Skip to first unread message

Jeff Johnston

unread,
Jul 22, 2007, 7:58:59 PM7/22/07
to JMesa
I think this is very exciting to see developers wanting to contribute
to bring a tag library to JMesa! I think the time is right as well
because the API has proven to be very solid and flexible.

So, with that, I do not want to miss out on the opportunity to help
make this work as smoothly as possible. If developers are interested I
would like to help define the specifications for a tag library. For
instance I think the tag attributes should be the same as the API
attributes for consistency. I would also think we would want to
flatten out the renderers and editors to be defined at the same level.
We also need to define what JSP tag specification we are going to
target.

I believe one of the main concerns for some of the tag code I received
was to make this similar to the DisplayTag library for ease of
transitioning over. I think this should be done through an adapter.
The idea is to make a library that makes sense for JMesa, but can be
adapted to work well with other frameworks. It seems that that should
be be possible to do, at least to be able to bring up your basic table
with the main features.

I am really big on designing up front. This (tag) feature is a little
different because the API is already done so if we can think of what
we lose (and gain) by using tags then we can meet expectations the
first time.

I would really like to hear different ideas and get peoples input, so
be sure to tell me any thoughts that you have. I would be interested
in hearing what features people want out of a tag library and any
ideas of the best way to implement them. If you are coming from the
eXtremeTable or the DisplayTag you could say what features you really
like and why. Or, you could talk about the features you thought could
be implemented better.

I created a wiki page to document the discussion:

http://code.google.com/p/jmesa/wiki/Tags

-Jeff Johnston

jeff jie

unread,
Jul 22, 2007, 11:48:29 PM7/22/07
to JMesa
yeah.I agree that the tag attibutes should be the same as the API
atributes.
I think the row tag is Optional.because Jmesa had afforded default
behavior.

at the time I make my tag Implementation,i found that.I need to create
another tag(Property tag)to support the column tag like this:
<jm:column name=""><a href="xxx.do?<jm:property/>"><jm:property
name="name"/></a></jm:column>
I remeber the ExtremeTable tag useage:
<ec:table items="books" var="book">
...........
<ec:column property ="">${book.name}</ec:column>
</ec:table>
the Jmesa's table tag is very hard to export a var attribute.I
tried.because Jmesa table tag is not a real time Iterator,it is just a
table definition.
if Jmesa want to do things like ExtremeTable's column tag.Property tag
can help.
later,I will send you my code.and demo.
by the way,have a look at my Tag Lib Definition,i think it is very
close to Jmesa Tag lib specification :)

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag
Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>

<tlibversion>2.0.1</tlibversion>
<jspversion>1.2</jspversion>
<shortname>jmesa</shortname>
<uri>http://code.google.com/p/jmesa</uri>

<tag>
<name>table</name>
<tagclass>org.jmesa.tags.TableTag</tagclass>
<bodycontent>jsp</bodycontent>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>items</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>caption</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>export</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>style</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>styleClass</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>border</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>width</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>cellpadding</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>cellspacing</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

<tag>
<name>column</name>
<tagclass>org.jmesa.tags.ColumnTag</tagclass>
<bodycontent>jsp</bodycontent>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>title</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>sortable</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>filterable</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>width</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

<tag>
<name>property</name>
<tagclass>org.jmesa.tags.PropertyTag</tagclass>
<bodycontent>jsp</bodycontent>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>

Jeff Johnston

unread,
Jul 23, 2007, 8:30:02 PM7/23/07
to JMesa
Your attributes look good to me. The only one I would rename is the
table export attribute to exportTypes. That is the name I use
throughout the API.

I am not sure how you are going to use the PropertyTag though. I will
have to wait to see your code to understand that better.

However There are two different ways that you could make the tag more
iterative though. These are just two ways that I was thinking might
work...

One way would be to build up a List of Maps to use as the items. If
you remember you can use a Collection of Maps for the data. What you
would do is iterate over the column tags with the regular items and
then load up the List of Maps. In the end you will have a List of Maps
that is identical to the regular items except all the column values
will be resolved through the JSP template parser. Does that make
sense? The List of Maps represents the table items, but you would
build it up as you process through all the rows and columns. The key
of the Map would be the column property and the value would be the
column tag value. You would probably have to make a custom view...take
a look at the HtmlSnippetsImpl body() method. The line that says
Collection items = coreContext.getPageItems(); would have to be
replaces with your List of Maps.

Another way you could do this is create a different HtmlSnippets class
to work with a custom View in which you would build up the table as
you iterate over the column tags. You would still need to fill up a
Map and pass that in place of the regular item. This is very similar
to the first way I recommended but may be more flexible.

What you should do is look at the HtmlView class and the
HtmlSnippetsImpl class and think about how you could make those work
in a iterative way.

Let me know if you have any questions and we can talk more about it.

-Jeff

jeff jie

unread,
Jul 23, 2007, 10:04:16 PM7/23/07
to jm...@googlegroups.com
I agree the two ways you said.
At first,I had the same ideas.but I think....to create another HtmlSnippets is trouble.that is the reason of the birth of the Property Tag.
Property Tag accept a name attribute,leave a mask(#{attributeName}) inside the columnTag.the column tag scan it's bodyContent and pass bodyContent to an HtmlMaskCellEditor.this editor replace the mask to real value at run time.

My implementation is a Table definition(not real time Iterator),use the Jmesa API directly.the shortage is,you must use the Property tag instead the Jsp template language.It means,you can write the code like this:

<jm:column><jm:property name="attr"/></jm:column>

but you can NOT do this:

<jm:column>${attr}</jm:column>

To design a taglib,userfriendliness is important!may be I should consider the ways you said.

before I start to make an other implementation,i like to show you my code.I'll send you tonight :)

best wishes.

2007/7/24, Jeff Johnston <extremec...@gmail.com>:

Jeff Johnston

unread,
Jul 23, 2007, 10:32:31 PM7/23/07
to JMesa
I will be very interested in seeing the work that you do! The excel
view was really done well.

I wouldn't hesitate to create a different View or HtmlSnippets class
though. Views are meant to be customized and the HtmlSnippets class
was just a way to try to get some re-use out of some common code. You
could either even consider extending or wrapping the existing
HtmlSnippets class and just customize the things that make sense. I
think wrapping that class would probably work the best though as it
would be a lot more robust and clear about what you are doing.

-Jeff Johnston


On Jul 23, 9:04 pm, "jeff jie" <bbm...@gmail.com> wrote:
> I agree the two ways you said.
> At first,I had the same ideas.but I think....to create another HtmlSnippets
> is trouble.that is the reason of the birth of the Property Tag.
> Property Tag accept a name attribute,leave a mask(#{attributeName}) inside
> the columnTag.the column tag scan it's bodyContent and pass bodyContent to
> an HtmlMaskCellEditor.this editor replace the mask to real value at run
> time.
>
> My implementation is a Table definition(not real time Iterator),use the
> Jmesa API directly.the shortage is,you must use the Property tag instead the
> Jsp template language.It means,you can write the code like this:
>
> <jm:column><jm:property name="attr"/></jm:column>
>
> but you can NOT do this:
>
> <jm:column>${attr}</jm:column>
>
> To design a taglib,userfriendliness is important!may be I should consider
> the ways you said.
>
> before I start to make an other implementation,i like to show you my code.I'll
> send you tonight :)
>
> best wishes.
>

> 2007/7/24, Jeff Johnston <extremecompone...@gmail.com>:

> ...
>
> read more »

sburch79

unread,
Aug 4, 2007, 11:24:48 PM8/4/07
to JMesa
I like the tag definition on the wiki. Much more robust than the stuff
I did. The only thing mine did that isn't necessarily part of the tag
api but was handled by the tag was ajax. My table tag wrote out some
javascript to handle paging and sorting and I included a servlet that
would handle that as well. This did require, however, that the objects
be put on the session. Hopefully, next week we'll upgrade to the 2.1
release and I'll try everything out.

On Jul 23, 10:32 pm, Jeff Johnston <extremecompone...@gmail.com>

> ...
>
> read more »

Jeff Johnston

unread,
Aug 5, 2007, 12:01:26 AM8/5/07
to JMesa
I need to look into your ajax features more. I only started with the
other tag submission because it was a more straightforward way to work
with the API. I was not entirely sure why you had to customize so many
things...unless that was for the ajax. I figure once the tag was done
flat out straightforward it would be easier to add more custom
features if needed. Like I mentioned to the other developer I had my
head so buried in tweaking the API I didn't realize how easy it would
be bringing in a tag library. I am very happy both of you thought to
implement tags.

Between the tags and the facade building tables is really easy now.

-Jeff Johnston

> ...
>
> read more »

Reply all
Reply to author
Forward
0 new messages