Display tag learning and research 2

Source: Internet
Author: User

<JSP: Root version = "1.2" xmlns: JSP = "http://java.sun.com/JSP/Page" xmlns: Display = "urn: jsptld: http://displaytag.sf.net"
Xmlns: c = "urn: jsptld: http://java.sun.com/jstl/core">

<JSP: Directive. Page import = "Java. util. *"/>
<JSP: Directive. Page contenttype = "text/html; charsets = UTF-8"/>
<JSP: Directive. Page import = "My. Bean. *"/>
<Head> <title> my tags </title> <JSP: Include page = "INC/header. jsp" Flush = "true"/>
<JSP: scriptlet>
TV mytv = new TV ();
Mytv. setid (1 );
Mytv. setname ("PP ");
Mytv. seturl ("/my.rar ");
Mytv. setpic ("RAR ");
TV mytv3 = new TV ();
Mytv3.setid (3 );
Mytv3.setname ("PP ");
Mytv3.seturl ("/my.rar ");
Mytv3.setpic ("RAR ");
TV mytv2 = new TV ();
Mytv2.setid (2 );
Mytv2.setname ("2pp2 ");
Mytv2.seturl ("/my2.rar ");
Mytv2.setpic ("RAR ");
TV mytv4 = new TV ();
Mytv4.setid (4 );
Mytv4.setname ("2pp2 ");
Mytv4.seturl ("/my2.rar ");
Mytv4.setpic ("RAR ");
List testlist = new arraylist ();
Testlist. Add (mytv );
Testlist. Add (mytv2 );
Testlist. Add (mytv3 );
Testlist. Add (mytv4 );
Request. setattribute ("test", testlist );

Request. setattribute ("dyndecorator", new org. displaytag. decorator. tabledecorator ()
{
Public String addrowclass ()
{
Return (TV) getcurrentrowobject (). GETID ()> 2? "Good": "bad"; // good is bold
}
Public String addrowid ()
{
Return "myrow" + evaluate ("ID ");
}
});
// The above pink text is decorated, and the good and bad style pink words can be deleted

</Jsp: scriptlet>
<Display: Table name = "test" defaultsort = "1" defaultorder = "ASCENDING" decorator = "dyndecorator" class = "simple"
Pagesize = "2"> // The style is ISIS; its; Mars; simple; Report; Mark column;
<Display: caption> TV table </display: caption>
<Display: column property = "ID" Title = "Serial Number" href = "tvdetails. JSP "paramid =" ID "sortable =" true "headerclass =" sortable "> </display: column> // The property here should be TV. java attributes are consistent.
<Display: Column Title = "email" autolink = "true" maxlength = "20" class = "textred"> email@it.com </display: column> // second writing of Column
<Display: column property = "name" Title = "file name" sortable = "true" headerclass = "sortable"> </display: column>
<Display: footer>
<Tr>
<TD colspan = "4"> sample footer </TD>
</Tr>
</Display: footer>
</Display: Table>

</Jsp: root>

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.