我想要在display tag标签库生成的表中添加一个链接 ,链接中的参数要使用propertylai 获取
代码:<display:table name="list" pagesize="10" requestURI="/commentServlet">
  <display:column style="width:80px" maxLength="200" property="id" title="评论编号" /> 
  <display:column style="width:80px" property="blog_id" title="博客编号" /> 
  <display:column style="width:80px" property="username" title="评论人" />
  <display:column style="width:480px height:4px" property="content" title="内容" />
  <display:column value="dede" title="操作"  url="/commentServlet?method=delete&id=" paramId="id" paramName="Comment" paramProperty="id" ></display:column>
</display:table>
---------------------------------------------------
java bean:
import java.util.Date;public class Comment {

private String username;
private String content;
private Date createdtime;
private String id;
private String blog_id;

public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getBlog_id() {
return blog_id;
}
public void setBlog_id(String blog_id) {
this.blog_id = blog_id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getCreatedtime() {
return createdtime;
}
public void setCreatedtime(Date createdtime) {
this.createdtime = createdtime;
}
}我在网上看见有人说要paramid,paramName,paramProerty一起使用,可是我使用后能生成参数id,但是获取不到id的值,这是为什么呢

解决方案 »

  1.   

    没用的,你要实现复合连接,也就是要携带两个以上参数,通过paramId是无法实现的,一般是这样<display:column href="getInfoCustom.action" paramId="customUser.cuserId" paramProperty="cuserId"
    title="客户信息" style="text-align:center">查看</display:column> 最快也是最简洁的解决办法就是通过JSTL来构造link,这种方法不再限制只能传递一个参数,给程序的处理带来了方便。使用Struts2 , JSTL和DisplayTag结合,构造link会使程序更易维护。下面是简短的JSTL和DisplayTag结合在一起的方法。<display:table name="jobz" class="simple" id="row" >
      <display:column  titleKey="label.global.actions" >
                 <c:url var="viewurl" value="/viewJobDetail.action">
                         <c:param name="name" value="${row.name}"/>
                         <c:param name="groupName" value="${row.group}"/>
                 </c:url>
                 <c:url var="exeurl" value="/viewJobDetail.action">
                         <c:param name="name" value="${row.name}"/>
                         <c:param name="groupName" value="${row.group}"/>
                         <c:param name="executeJobAction" value="execute"/>
                 </c:url>
                 <c:url var="editurl" value="/viewJobDetail.action">
                         <c:param name="name" value="${row.name}"/>
                         <c:param name="groupName" value="${row.group}"/>
                         <c:param name="editAction" value="edit"/>
                 </c:url>
          <a href='<c:out value="${viewurl}"/>'><fmt:message key="label.global.view"/></a> |
          <a href='<c:out value="${editurl}"/>'><fmt:message key="label.global.edit"/></a> |
          <a href='<c:out value="${exeurl}"/>'><fmt:message key="label.global.execute"/></a> 
    </display:column> 
      

  2.   

    首先谢谢gl74gs48的回答,提醒我用jstl,我在用jstl的时候发现一个问题,那就是当我设置参数时<c:param name="id" value="${comment.id}"/>这样获取不到comment的id值,这是怎么回事呢?
      

  3.   

    谢谢你的帮住,我已经解决问题了,原来是因为<display:table>中找不到comment这个类,要在<display:table       id="comment">就可以了!