olá galera,
estou utilizando display tag para fazer uma paginação de dados e decoradores para criar links, o problema é que quando utilizo o método
getCurrentRowObject() para recupera o objeto corrente, ou seja, o objeto
que clico no link, sempre recupero o primeiro registro da paginação(da pagina corrente), alguém tem alguma idéia…
vejam os códigos:
o JSP
<%@ page import="br.cefetce.lar.invente.*" %>
<%@ page import="java.util.*" %>
<%@ page import="org.displaytag.decorator.TableDecorator.*" %>
<%@page errorPage="error.jsp" %>
<%@taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@include file="FormSearchEnredo2.jsp" %>
<%
Vector vetor = (Vector) session.getAttribute("vetor");
//session.putValue("vetor", vetor);
session.setAttribute("vetor", vetor);
//request.setAttribute("vetor",vetor);
//System.out.println(vetor);
%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../../css/displaytagex.css">
<link href="images/css/grid.css" type="text/css" rel="stylesheet" />
</head>
<body background="../../_themes/romtextb.jpg" bgcolor="#cccccc">
<font color=red>
<div id ="grid" align=center>
<display:table name="${vetor}" style="width: 85%; border: 0px" pagesize="5" export="true">
<display:column property="id" title="Id" decorator = "br.cefetce.lar.invente.CheckWrapper"/>
<display:column property="title" title="Título" style="width:200px" />
<display:column property="author" title="Autor" style="width:250px" />
<display:column property="institution" title="Institutição" />
<display:column property="provisionDate" title="Provision Date" style= "width: 100px" />
<display:column property="learningObjectType" title="Tipo de Objeto Educacional" />
<display:setProperty name="export.pdf" value="true"/>
</display:table>
</font>
</body>
</html>
o decorator
package br.cefetce.lar.invente;
import javax.servlet.jsp.PageContext;
import org.displaytag.decorator.DisplaytagColumnDecorator;
import org.displaytag.decorator.ColumnDecorator;
import org.displaytag.decorator.TableDecorator;
import org.displaytag.exception.DecoratorException;
import org.displaytag.properties.MediaTypeEnum;
import com.sun.org.apache.bcel.internal.generic.RET;
import br.cefetce.lar.invente.*;
public class CheckWrapper implements DisplaytagColumnDecorator{
public class CheckWrapper extends TableDecorator{
Object current = getCurrentRowObject();
public String getTitle() throws DecoratorException {
System.out.println(((FormResultBean)this.getCurrentRowObject()).getId());
return "<FORM name='submitForm' method='post' action='http://localhost:8080/enredo1.1.4/RootSearchEnredo'>" +
"<input type='hidden' name='submitForm' value='"+((FormResultBean)this.getCurrentRowObject()).getId()+"'checked/>"+
"<a href='javascript:document.submitForm.submit()'>"+((FormResultBean)this.getCurrentRowObject()).getAuthor()+"</a><a href='#' ></a>";
}
}
conto com a ajuda de vc’s…