在Struts2 + Freemarker环境中使用 自定义的JSP Tag

比如说,使用 jmesa这个标签库。FTL应该这样写:

1. 声明一下标签库

<#assign ec=JspTaglibs["/WEB-INF/tld/jmesa.tld"]>

2. 使用extremetTable标签

<@jmesa.tableFacade id="users_table" 
items=users var="user">

                  <@jmesa.htmlTable width="100%">

                    <@jmesa.htmlRow>

                      <@jmesa.htmlColumn property="loginId" title="Login Id"/>

                      <@jmesa.htmlColumn property="firstName" title="First Name"/>

                      <@jmesa.htmlColumn property="lastName" title="Last Name"/>

                    </@jmesa.htmlRow>

                  </@jmesa.htmlTable>

                </@jmesa.tableFacade>

    a.要写 "<@jmesa.tableFacade>",而不是 "<jmesa:tableFacade>"

    b.类集变量的表达式是不带引号的users,而不是"users",也不是 "${users}"

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.