Results 1 to 4 of 4
  1. #1
    yuchuang is offline Member
    Join Date
    Apr 2007
    Location
    Singapore
    Posts
    29
    Rep Power
    0

    Default Data formatting for the <display:table>

    Hi, i would like to ask in struts if we are using <display:table> to display our data, then how do we format our data? meaning how to align the data displayed to be align center instead of the default left?

  2. #2
    goldhouse is offline Senior Member
    Join Date
    Mar 2007
    Posts
    134
    Rep Power
    0

    Default

    Java Code:
    <logic:iterate id="someName" name="a">
    
        <display:table id="row" name="pageScope.someName.resultEntries"  
    class="dptag" pagesize="15" requestURI="">
           <display:column title="A Column" >
              <A HREF='<bean:write name="row" property="url"/ >'>
    	<bean:write name="row" property="propertyName"/></A>
           </display:column>
           <display:column title="SomeColumn" >
              <bean:write name="row" property="propertyName"/>
           </display:column>
        </display:table>
    
    </logic:iterate>
    Then use the CSS to define the classes

  3. #3
    yuchuang is offline Member
    Join Date
    Apr 2007
    Location
    Singapore
    Posts
    29
    Rep Power
    0

    Default

    I tried using CSS.
    .alignment { text-align: center }
    and i placed it here..
    <display:column title="SomeColumn" style="alignment">
    Is this the correct way to do it? I feel there's something wrong cos it don't seems to work.

  4. #4
    felixtfelix is offline Member
    Join Date
    Dec 2007
    Location
    Mumbai, India
    Posts
    37
    Rep Power
    0

    Default you can use align attribute

    Try the following

    <display:table name="requestScope.employeeList" pagesize="10">
    <display:column property ="employeeName" title="Employee Name"/>
    <display:column property ="dateOfBirth" title="Date of Birth"/>
    <display:column property ="employeeCode" title="Employee Code"/>
    <diaplay:column property ="employeeNumber" title="Employee Number" align="right"/>

    where employeeList is a type of ArrayList which contains the formbean of EmployeeBean for each record. EmployeeBean is a class which contains property with only getters and setters.

    eg.
    class EmployeeBean
    {
    private String employeeName;


    public String getEmployeeName()
    {
    return this.employeeName
    }

    public void setEmployeeName(String employeeName)
    {
    this.employeeName = employeeName

    }
    }

    EmployeeBean bean = null;
    List employeeList = new ArrayList();
    while(rs.next())
    {
    bean = new EmployeeBean();
    bean.setEmployeeName(rs.getString("employee_name") )
    employeeList.add(bean);
    }

    requestScope.setAttribute("employeeList",employeeL ist);


    I think it will help u.

Similar Threads

  1. Data from a model class won't show up in the table
    By ayampanggang in forum AWT / Swing
    Replies: 3
    Last Post: 11-27-2008, 09:20 PM
  2. how to display the alerts in table
    By geeta_ravikanti in forum JDBC
    Replies: 4
    Last Post: 04-04-2008, 07:45 AM
  3. Replies: 0
    Last Post: 02-09-2008, 09:22 PM
  4. Replies: 4
    Last Post: 01-05-2008, 08:39 PM
  5. Jsf, Filtering Data In A Table
    By Freddie in forum JavaServer Faces (JSF)
    Replies: 2
    Last Post: 05-11-2007, 01:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •