Suppose you've got 1000 records in a requestScope list or map called data:
<display:table name="data" scope="request" id="record">
<display:column title="Title 1" property="property1"/>
</display:table>
and so on... There's a manual also. And you can provide the size of the page, the styles, an url to lin on each column. You can render a column by yourself or make it to autolink if the column is an url or emailaddress...
Check the examples, they tell you how to do the whole thing. Also I'll cut'n' paste here a real code of my own for you to see. It's embeded in a struts based application. See the pagesize and requestURI wich will help you do the paging. The requestURI should store the data in an attribute called "listaContactos" in scope session. I just store the data when a search is requested, the pagination is done by the displaytag so if the user don't changes the search criteria the list is the same as in the previous page but just shows up the next 10 records... hope to have explained, sorry my bad english:
<<
<display:table sort="list" name="listaContactos"
scope="session" id="contacto"
requestURI="/secret/gestion/buscarContactos/view.do" pagesize="10"
align="center" width="400px">
<display:setProperty name="basic.msg.empty_list">
<p align="center">
No hay resultados para la búsqueda.
</p>
</display:setProperty>
<display:column title="Nombre"
sortable="true"
url="/secret/gestion/editarContacto.do?accion=editar"
paramId="key"
paramProperty="contactoId">
<bean:write name="contacto"
property="apellido1"/> <bean:write name="contacto"
property="apellido2"/>, <bean:write name="contacto"
property="nombre"/>
</display:column>
<logic:match name="buscarContactosForm"
property="contactoEmpresa" value="true">
<display:column title="Cargo"
property="cargo"
sortable="true"
url="/secret/gestion/editarContacto.do?accion=editar"
paramId="key"
paramProperty="contactoId"
group="15"/>
<display:column title="Empresa"
property="nombreEmpresa"
sortable="true"
url="/secret/gestion/editarEmpresa.do?accion=editar"
paramId="key"
paramProperty="empresaId"
group="15"/>
</logic:match>
<display:column title="Teléfono"
property="tlf1" width="60px"/>
</display:table>
>>
<display:table name="data" scope="request" id="record">
<display:column title="Title 1" property="property1"/>
</display:table>
and so on... There's a manual also. And you can provide the size of the page, the styles, an url to lin on each column. You can render a column by yourself or make it to autolink if the column is an url or emailaddress...
Check the examples, they tell you how to do the whole thing. Also I'll cut'n' paste here a real code of my own for you to see. It's embeded in a struts based application. See the pagesize and requestURI wich will help you do the paging. The requestURI should store the data in an attribute called "listaContactos" in scope session. I just store the data when a search is requested, the pagination is done by the displaytag so if the user don't changes the search criteria the list is the same as in the previous page but just shows up the next 10 records... hope to have explained, sorry my bad english:
<<
<display:table sort="list" name="listaContactos"
scope="session" id="contacto"
requestURI="/secret/gestion/buscarContactos/view.do" pagesize="10"
align="center" width="400px">
<display:setProperty name="basic.msg.empty_list">
<p align="center">
No hay resultados para la búsqueda.
</p>
</display:setProperty>
<display:column title="Nombre"
sortable="true"
url="/secret/gestion/editarContacto.do?accion=editar"
paramId="key"
paramProperty="contactoId">
<bean:write name="contacto"
property="apellido1"/> <bean:write name="contacto"
property="apellido2"/>, <bean:write name="contacto"
property="nombre"/>
</display:column>
<logic:match name="buscarContactosForm"
property="contactoEmpresa" value="true">
<display:column title="Cargo"
property="cargo"
sortable="true"
url="/secret/gestion/editarContacto.do?accion=editar"
paramId="key"
paramProperty="contactoId"
group="15"/>
<display:column title="Empresa"
property="nombreEmpresa"
sortable="true"
url="/secret/gestion/editarEmpresa.do?accion=editar"
paramId="key"
paramProperty="empresaId"
group="15"/>
</logic:match>
<display:column title="Teléfono"
property="tlf1" width="60px"/>
</display:table>
>>
Comments
Post a Comment