Display Study Notes

Source: Internet
Author: User

1. When a set is written into the request, cannot it be displayed during page turning? Solution: Add <display: Table> to requesturi = "displaylist. Do.

2. When there is no data record, displaytag will output "nothing found to display." by default, and there is no header. Modify the tabletag. properties file in displaytag. jar to customize the Output Message and style. 1) Basic. Empty. showtable = false: Set the attribute to true, and the header will appear. 2) Basic. MSG. empty_list = nothing found to display. modify Information 3) Basic. MSG. empty_list_row = <tr class = "empty"> <TD colspan = "{0}"> nothing found to display. </TD> </tr> you can modify the information.

3. if you encounter a problem with Chinese output, you can modify the tabletag. properties file by yourself.

4. Add export = "true" to display: Table to export data! By default, the display TAG provides three data export Methods: CSV, Excel, and XML. In addition, the display tag can also be exported to PDF format. In export <display: setproperty name = "export.pdf" value = "true"/>, this is done.

5. in displaytag, decorator has two usage principles: one is used in displaytag: table, and the other is used in displaytag: column. The former is valid for the corresponding attributes of the entire table, the latter is valid for a single column. Therefore, in the former, you must write the get method in the response's decorator class and name the method get + beanproperty (bean attribute). The former must inherit the tabledecorator class, the latter only needs to implement the decorate method of the columndecorator class (return a string ). This is the principle of decorator. When the decorator attribute is used, the data is first retrieved from the bean and then passed into the decorator, the former is to call the getcurrentrowobject method in the decorator class to obtain the current bean, and then call the get method of the bean to retrieve the attribute (Public String getdate () {return this. dateformat. format (listobject) This. getcurrentrowobject ()). getdate ();}), the latter is that the data is directly passed into its decorate method. after the data is processed, it is displayed on the page. Therefore, the decorator class is the package that packs the value of the original attribute and outputs the package, this is also a basic design model.

6. if you want to paging code, you only need to add a pagesize = "number of lines displayed per page" to the display: Table tag, as shown in <display: table name = "test" pagesize = "10"/>

7. Sort columns by using the display tag. You can click the column name to sort the data in the column. You only need to add sort = "true" to the column to be sorted. The following code can sort the first three columns. Add defaultsort = "Number of columns" to display: Table to sort the specified columns by default. <Display: Table name = "test" styleclass = "list" cellspacing = "0" cellpadding = "0" defaultsort = "1"> <display: column property = "ID" Title = "ID" class = "idcol" Sort = "true"/> <display: column property = "name" url = "detail. JSP "paramid =" ID "paramproperty =" ID "Sort =" true "/> <display: column property = "email" autolink = "true" Sort = "true"/> <display: column property = "Description" Title = "Comments"/> </display: table> If the table has pages, the display tag only sorts the current page by default. to sort the entire list, you can add a piece of code between display: Table:

8. set the connection <display: setproperty name = "sort. amount "value =" list "/> <display: Table name =" test "styleclass =" list "cellspacing =" 0 "cellpadding =" 0 "> <display: column property = "ID" Title = "ID" class = "idcol"/> <display: column property = "name" url = "detail. JSP "paramid =" ID "paramproperty =" ID "/> <display: column property =" email "autolink =" true "/> <display: column property = "Description" Title = "Comments"/> </display: Table>

9. you only need to add the group attribute <display: Table name = "test" class = "simple"> <display: column property = "city" Title = "city" group = "1"/> <display: column property = "project" Title = "project" group = "2"/> <display: column property = "amount" Title = "hours"/> <display: column property = "task" Title = "task"/> </display: Table>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.