我有一个数据库,可以看到使用 struts 和 jsp 的完整 HTML 表。
现在,我想用相同的数据配置一个 struts2-jquery-grid。有人可以帮助我吗?我一直在寻找几天,找不到这个任务。
这是我的行动:
package sead.painel.actions.dpp;
import java.util.List;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import sead.painel.dao.ConcursoDAO;
import sead.painel.modelo.dpp.Concurso;
import com.opensymphony.xwork2.ActionSupport;
@ParentPackage("default")
public class ListaConcursos extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 1L;
private List<Concurso> concursos;
@Action(value="lista-concursos", results={
@Result(name="success", location="lista-concursos.jsp")
})
public String execute(){
concursos = new ConcursoDAO().getLista();
return "success";
}
public List<Concurso> getConcursos() {
return concursos;
}
public void setConcursos(List<Concurso> concursos) {
this.concursos = concursos;
}
}
这里的jsp:
<%@taglib prefix="sj" uri="/struts-jquery-tags" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
<head>
<sj:head jqueryui="true" jquerytheme="redmond" />
</head>
<sj:a href="dpp/concursos" targets="tone">Voltar</sj:a>
<s:url action="lista-concursos" id="listaConcursos" />
<sjg:grid
gridModel="dpp/lista-concursos"
href="%{listaConcursos}"
caption="Lista de Concursos"
rowList="10, 15, 20"
rowNum="10"
rownumbers="true"
pager="true"
dataType="json">
<sjg:gridColumn name="nome" index="nome" title="Nome" dataType="text" value="#concurso.nome" />
<sjg:gridColumn name="codigo" index="codigo" title="Codigo" dataType="json" value="#concurso.codigo" />
</sjg:grid>
网格不加载任何东西。但我可以使用 .