Results 1 to 6 of 6

Thread: How To Use The displaytag in java

  1. #1
    Join Date
    Jan 2010
    Posts
    59

    How To Use The displaytag in java

    Hello, I am working on java programming language and while working on it, I want to know the details about the java programming language displyatag. If you are having any kind of information from which I can able to know it, then please provide details about it, I will be thankful to you. So, please help me to know the details about the displytag.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How To Use The displaytag in java

    In all web applications, we always need to display a series of records or lists of items using tables in html. It must then iterate over the list, manage the header line of the table and ensure pagination. This quickly becomes cumbersome and repetitive. In J2EE, the library Displaytag provides a quick, convenient and effective to this problem. This Taglib provides a very simple mechanism to iterate over a collection, one running directly from the code of a jsp. The result gives the display a html table with a wealth of options such as sorting on columns, pagination, grouping data or export the table to CSV, excel, xml, html or rtf .

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: How To Use The displaytag in java

    Here is an example of using simple tool to display as an array list named "mylist" containing objects of type "User".
    Code:
    Public class Test (
    	int id;
    	String name;
    	String surname;
    	String email;
    	int age;  
    	}
    
    <display: table name ="mylist" />

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: How To Use The displaytag in java

    Hello, simply consider the example below. This example allows specify the columns you want displayed and the names of the headers of these columns.
    Simply add the tag <display:column property="...">. property is the name of the attribute in the User bean.
    Code:
    <display: table name ="mylist" >
    <display: column property ="id" title ="No." />
    <display: column property ="name" title ="Name"  />
    <display: column property ="firstname" title ="Name"  />
    <display: column property ="email" title ="Email"  />
    </ display: table>

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How To Use The displaytag in java

    The library offers another mechanism called Decorator. This makes class inheriting from the class TableDecorator.
    In these classes define methods that will be called when generating tables. A mapping is automatically made between the attributes of property tags and column methods. You can easily change the look of the display of a column. For example, if you want to display currency or dates or if you want to dynamically generate html links. In your java you will create the code below:

    Code:
    Public class Designing extends TableDecorator 
    {
        Public String getMyLink ()
        {
            User use = (User) getCurrentRowObject ();
            int lid = use.getId ();        
            return "<a href = \" details.jsp? useid = " + Lid + "\"> Edit </ a> ";
        }
    }
    And your jsp page must contains the below code:
    Code:
    <display: table name ="mylist" decorator ="Designing" />
        <display: column property ="id" title ="No." />
        <display: column property ="name" title ="Name" />
        <display: column property ="firstname" title ="Name" />
        <display: column property ="email" title ="Email" />
        <display: column property ="myLinks" title ="" />
    </ display: table>

  6. #6
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How To Use The displaytag in java

    The Displaytag offer many other possibilities:
    • when you have a list whose items are sorted and grouped in several columns: instead of repeating the same values in these columns, only values that change will be displayed
    • aggregation of a column,
    • a header (header) and footnote (footer) table,
    • formatting dates and numbers,
    • external paging. This helps manage the program by manually sorting and paging.

Similar Threads

  1. Replies: 4
    Last Post: 04-09-2013, 11:04 PM
  2. Setting Of Java to The Point At Manual Java
    By winni in forum Software Development
    Replies: 4
    Last Post: 10-01-2011, 10:05 PM
  3. Java Programming using Adventnet SNMP Java API
    By ROCKING_Suhas in forum Software Development
    Replies: 5
    Last Post: 17-07-2010, 06:52 AM
  4. Link List Example in Java Sample program in Java
    By trickson in forum Software Development
    Replies: 2
    Last Post: 04-08-2009, 08:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,051,923.19199 seconds with 16 queries