Value List Handler


Standard Syntax:
     <%@ taglib prefix="vlh" uri="http://valuelist.sourceforge.net/tags-valuelist" %>

XML Syntax:
     <anyxmlelement xmlns:vlh="http://valuelist.sourceforge.net/tags-valuelist" />

Value List Handler

Tag Library Information
Display NameValue List Handler
Version1.0
Short Namevlh
URIhttp://valuelist.sourceforge.net/tags-valuelist
 

Tag Summary
rootThis tag is required as a root tag for all other vlh tag.

Example

  • <vlh:root id="tableOfBooks" value="list" url="?" includeParameters="bookId|#" >
  • It will forward request param 'bookId' as well. Actions params are excluded automatically for any tableId. ValueListInfo.DO_FOCUS param you cannot forward. It is forbidden.

    checkboxNo Description
    filterThis tag generates an anchor, including all the parameters.
    selectNo Description
    filtersNo Description
    rowThis is an iterate tag. This tage takes the ValueList and iterates the elements in the ValueList.list property.
    headerRender only header.

    Example

    <vlh:header>
      <vlh:column title="playerid" property="playerid" sortable="desc" />
      <vlh:column title="lastname" property="lastname" sortable="desc" />
    </vlh:header>
    inverted-rowNo Description
    column

    Render a column of the iterated row.

    Example

    <vlh:column title="Id of Player" property="id" sortable="desc" emphasisPattern="1"/>
      Render column with the title "Id of Player." and in its rows will be ids, some of them will be highlighted, if they contains "1".
    dynabeanNo Description
    attribute

    Append to the nearest parent that implement interface Attributeable html attributes.

    Usage

    <vlh:row bean="player">
      <vlh:attribute name="onclick">toggle(this);</vlh:attribute> ...
    </vlh:row>

    Result in

      <tr onclick="toggle(this);"> ... <tr>

    pagingGenerate panel for controlling of paging and focusing. For best understanding see war file with examples. When bodyContent is empty,it will render pages like with bodyContent <c:out value="${page}"/>. The style class for Summary is s Summary and StylePrefix+Summary analogical for paging : Paging and StylePrefix+Paging or for whole table PagingTag and StylePrefix+PagingTag
    1. <vlh:paging showSummary="true" pages="3" </vlh:paging>
        This will generate somethink like this 1 2 3
    2. <vlh:paging showSummary="true" pages="3"><c:out value="${page}"/></vlh:paging>
        The same usage but with non empty body content using pageContext's variable page. If you are using more than 1 table, the name of the page variable is different. At that case it's like this: pageMyTable, where MyTable is vlh:Root's id.
    3. <vlh:paging showSummary="true" showItemsPerPage="true" pages="3" </vlh:paging>
        This will generate input box with for number of items per page as well. (It use javascript to set conreate value.,this will be removed in near feature.)
    focusStatusCreate a table with the focus status, from jsp you can retrieve it as ${focusStatus[nameOfTable]}.

    When you set ValueListInfo.focusProperty, the focus is enabled and the tag will generate status. Otherwise it drop all bodycontent from this tag.

    It return ValueListInfo.FOCUS_FOUND, ValueListInfo.FOCUS_TOO_MANY_ITEMS, ValueListInfo.FOCUS_FOUND.

    To generate status it use this message source's properties:

    • focusStatus.tooManyItems =≶li>Too many items≶/li>
    • focusStatus.notFound = ≶li>The focus value {0} not found≶/li>

    retrieve

    Retrieve a ValueList from adapter in a JSP. In MVC style programming you should't do that! Instead of this use ValueListHandlerHelper in a controller.

    Example

    <vlh:retrieve name="players1" focusProperty ="id" focusValue ="30204" />

      It retrievies data from the named adapter "players1" and focus on page, where is player with id 30204.

    The name of adapter depends on configuration bean, where is a map of adapters like this:

      <bean id="valueListHandler" singleton="true" class="net.mlw.vlh.DefaultValueListHandlerImpl">
        <property name="config.adapters">
          <map>
            <entry key="players1">
              <bean class="net.mlw.vlh.adapter.hibernate.Hibernate20Adapter">
                <property name="sessionFactory"><ref bean="mySessionFactory"/></property> <property name="defaultNumberPerPage"><value>20</value></property> <property name="defaultSortColumn"><value>lastName</value></property> <property name="defaultSortDirection"><value>asc</value></property> <property name="hql">
                  <value>
                    FROM net.mlw.data.Player AS vo /~name: WHERE vo.lastName LIKE {name} ~/ /~sortColumn: ORDER BY vo.[sortColumn] [sortDirection]~/
                  </value>
                </property>
                <property name="defaultFocusPropertyObjectAlias"><value>vo</value></property>
                <property name="maxRowsForFocus"><value>160000</value></property>
                <property name="removeEmptyStrings"><value>true</value></property>
              </bean>
            </entry>
          ... </map>
        </property>
      </bean>

    controlsUse to add special column for controling of the row.
    actionUse to add listeners for actions. You can use it for an edit or delete row actions in MVC.

    Example

    <vlh:root url="baseUrl.do" >
      <vlh:controls titleKey="Control" >
      • <vlh:action url="edit.jsp?" customParameters="<%=customParams%>">

        Add custom hashMap params to url and use "edit.jsp?" as the base url.

          <vlh:addParam name="dynamicId" property="id" temp="false"/>

          Add to parent (action) param.

        This is a link 1.

        </vlh:action>
      • Render url like ..\edit.jsp?&dynamicId="Row-Java-Bean.getId()"&custumParam1=customParamValue1&....&customParamN=customParamValueN


        |
      • <vlh:action customParameters="<%=customParams%>">

        Add custom hashMap params to url and use <vlh:root url="baseUrl.do" as the base url.

          <vlh:addParam name="dynamicId" property="id" temp="false"/>
        This is a link 2.

        </vlh:action>
      • Thus Rendered url is like ..\baseUrl.do?&dynamicId="Row-Java-Bean.getId()"&custumParam1=customParamValue1&....&customParamN=customParamValueN

      </vlh:controls>
    ...
    </vlh:root>
    addParamSetter of any params to parant tag such as root, or action.

    Example Action

    <vlh:action url="\delete.do?" customParameters="<%=customParams%>">
      This will generate base url ..\delete.do?
    • <vlh:addParam name="id" property="id" temp="true"/>
    • Add param to url like &ACTid="Row-Java-Bean.getId()"

    • <vlh:addParam name="id" property="id" temp="false"/>
    • Add param to url like &id="Row-Java-Bean.getId()"

    • <vlh:addParam property="xyz" />
    • Add param to url like &ACTxyz="javabean.getXyz()"

    • <vlh:addParam name="OneStaticParam" value="OneStaticValue" temp="false"/>
    • In every row of the grid will be rendered url with static param &OneStaticParam="OneStaticValue"

    This is a link </vlh:action>

    Example Root

    <vlh:root url="?" customParameters="<%=customParams%>">
    • <vlh:addParam name="method" value="doView" temp="false"/>
    • Add to the base url a static param. Thus the rendered url look like this
      ..\?method=doView

    </vlh:root>
     


    Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-3 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.