Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用Spring控制器填充jeasyui数据网格_Java_Jquery_Spring - Fatal编程技术网

Java 如何使用Spring控制器填充jeasyui数据网格

Java 如何使用Spring控制器填充jeasyui数据网格,java,jquery,spring,Java,Jquery,Spring,我没有实现使用SpringMVC控制器进行模拟 DataGrid未使用检索到的Java/Spring控制器数据填充其行。我并没有复制EntyreJSP,它的代码与上面示例中的代码非常相似 Spring“ControlTeste”如下所示,负责从DB中检索数据,构建Json字符串(使用Gson)并将其作为响应发送。在本教程中,此任务是使用PHP完成的(直接从视图中完成,没有“控制器”层) DataGrid的配置(在JSP中)是: $('#dg').edatagrid({ url:'Control

我没有实现使用SpringMVC控制器进行模拟

DataGrid未使用检索到的Java/Spring控制器数据填充其行。我并没有复制EntyreJSP,它的代码与上面示例中的代码非常相似

Spring“ControlTeste”如下所示,负责从DB中检索数据,构建Json字符串(使用Gson)并将其作为响应发送。在本教程中,此任务是使用PHP完成的(直接从视图中完成,没有“控制器”层)

DataGrid的配置(在JSP中)是:


$('#dg').edatagrid({
url:'ControlTeste',
saveUrl:“状态创建”,
updateUrl:“状态更新”,
销毁URL:“状态删除”
});  
身份证件
西格拉
描述
埃罗?
决赛?
现在我只对“ControlTeste”控制器感兴趣,因为它负责检索数据以填充DataGrid


谢谢你的帮助

回答我的问题,也许有一天它会对某人有用:

    @RequestMapping(value = "/StatusLista")
    public @ResponseBody String teste(Status Status, 
                                        HttpSession httpSession, 
                                        HttpServletRequest req,
                                        HttpServletResponse res) throws IOException {
        Session sess = (Session) httpSession.getAttribute("hibSess");
        StatusDAO staDao = new StatusDAO(sess);
        List<Status> lista = staDao.findAll();

        Gson gson = new GsonBuilder().setDateFormat("dd-MM-yyyy").setPrettyPrinting().create();
        String gListStatus = gson.toJson(lista);
        return gListStatus;
    }
@RequestMapping(value=“/StatusLista”)
public@ResponseBody字符串测试(状态,
HttpSession HttpSession,
HttpServletRequest请求,
HttpServletResponse)引发IOException{
Session sess=(Session)httpSession.getAttribute(“hibss”);
StatusDAO staDao=新的StatusDAO(sess);
List lista=staDao.findAll();
Gson Gson=new GsonBuilder().setDateFormat(“dd-MM-yyyy”).setPrettyPrinting().create();
字符串gListStatus=gson.toJson(lista);
返回闪光状态;
}
我刚刚对我的控制器方法做了一些更改(我也更改了它的名称)

{
    "id": 2,
    "descricao": "Novo Status",
    "sigla": "STA",
    "estadoFinal": true,
    "erro": true
  }
<script type="text/javascript">
$('#dg').edatagrid({  
    url: 'ControlTeste',  
    saveUrl: 'StatusCreate',  
    updateUrl: 'StatusUpdate',  
    destroyUrl: 'StatusDelete'  
});  

<table id="dg" title="Cadastro de Status" class="easyui-datagrid"
    style="width: 700px; height: 250px" url="ControlTeste"
    toolbar="#toolbar" pagination="true" rownumbers="true"
    fitColumns="true" singleSelect="true">
    <thead>
        <tr>
            <th field="id" width="20">ID</th>
            <th field="sigla" width="40">Sigla</th>
            <th field="descricao" width="50">Descrição</th>
            <th field="erro" width="30">Erro?</th>
            <th field="estadoFinal" width="30">Estado Final?</th>
        </tr>
    </thead>
</table>
<div id="toolbar">
    <a href="javascript:void(0)" class="easyui-linkbutton"
        iconCls="icon-add" plain="true" onclick="novo()">Novo</a> <a
        href="javascript:void(0)" class="easyui-linkbutton"
        iconCls="icon-edit" plain="true" onclick="editar()">Editar</a> <a
        href="javascript:void(0)" class="easyui-linkbutton"
        iconCls="icon-remove" plain="true" onclick="remover()">Remover</a>
</div>
    @RequestMapping(value = "/StatusLista")
    public @ResponseBody String teste(Status Status, 
                                        HttpSession httpSession, 
                                        HttpServletRequest req,
                                        HttpServletResponse res) throws IOException {
        Session sess = (Session) httpSession.getAttribute("hibSess");
        StatusDAO staDao = new StatusDAO(sess);
        List<Status> lista = staDao.findAll();

        Gson gson = new GsonBuilder().setDateFormat("dd-MM-yyyy").setPrettyPrinting().create();
        String gListStatus = gson.toJson(lista);
        return gListStatus;
    }