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
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>
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
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 »
On Jul 23, 10:32 pm, Jeff Johnston <extremecompone...@gmail.com>
> ...
>
> read more »
Between the tags and the facade building tables is really easy now.
-Jeff Johnston
> ...
>
> read more »