是否可以将自定义图像放在显示标签分页中?

时间:2014-08-13 09:01:42

标签: java pagination displaytag

我使用了显示标记库进行分页。 在标签下面而不是编辑和删除我想放置编辑和删除图像,目前它显示编辑和删除文本。

我已经看过所有的演示但没有找到它。     

<display:setProperty name="paging.banner.placement" value="bottom" />
<display:column value="<%=row_rowNum%>" title="Sr. No" />  
<display:column property="prodName" title="Product Name"/>
<display:column property="modelName" title="Model"/>
<display:column property="manufacturer.mfgName" title="Manfufacturer name"/>
<display:column property="category.catName" title="Category"/>
<display:column property="active" title="Active"/>
<display:column property="id" title="Update" href="editDevice" paramId="id" paramProperty="id" format="edit"/>
<display:column property="id" title="Delete" href="deleteDevice" paramId="id" paramProperty="id" format="delete"/>

</display:table>

1 个答案:

答案 0 :(得分:1)

I had made decorators for it. We can't put image directly in the form inside display tag pagination.


deviceList.jsp

<display:table id="row" name="productEntities" pagesize="12" cellpadding="5px;" cellspacing="5px;" style="margin-left:50px;margin-top:20px;"   requestURI="" decorator="com.ei.openhome.utility.AddDeviceDecorator">>

<display:setProperty name="paging.banner.placement" value="bottom" />
<display:column value="<%=row_rowNum%>" title="Sr. No" />  
<display:column property="prodName" title="Product Name"/>
<display:column property="modelName" title="Model"/>
<display:column property="manufacturer.mfgName" title="Manfufacturer name"/>
<display:column property="category.catName" title="Category"/>
<display:column property="active" title="Active"/>
<display:column property="image_2" title="Edit" />
<display:column property="image_1" title="Delete" />

</display:table>

AddDeviceDecorator.java

public class AddDeviceDecorator extends TableDecorator {



    public String getImage_1()
    {
        ProductEntity actorData = (ProductEntity)getCurrentRowObject();

        String onclick = "onclick=deletes("+actorData.getId()+");";
         String image_1 =  "<img src="+"\""+"/openhome/images/system/delete.png"+"\""+" "+onclick+">";
        return image_1;
    }

    public String getImage_2()
    {
        ProductEntity actorData = (ProductEntity)getCurrentRowObject();


        String onclick = "onclick=edit("+actorData.getId()+");";
         String image_2 =  "<img src="+"\""+"/openhome/images/system/edit.png"+"\""+" "+onclick+">";
        return image_2;
    }

}