2013-06-21 92 views
0

我使用弹簧3与瓷砖2.我有分开的身体,标题和菜单。我想实现的是,当用户点击菜单中的选项时,只有主体被重新加载;保持菜单和标题静态。任何提示如何做到这一点?我已经尝试与Spring.addDecoration弹簧3瓷砖重新加载主体 - 保持标题和菜单静态

<script type="text/javascript"> 
Spring.addDecoration(new Spring.AjaxEventDecoration({ 
    elementId: "countryMenu", 
    formId: "countryMenuForm", 
    event: "onclick", 
    params: {fragments: "body"} 
})); 
</script> 

,但事先没有工作

感谢。

回答

0

这是我们正在研究的一个问题,在FINN.no 这就是我们希望组合模式(即Tiles提供)可以同时在服务器端和客户端工作。

今天我们采取一种简单的方法,在定义和属性名称的情况下,我们为此属性获取模板并将其重新渲染为客户端。我们为此使用胡子模板。

@RequestMapping(value = "template/{definitionName}/{attributeName:.+}", method = RequestMethod.GET) 
public static void fetchTemplateDefinition(
     @PathVariable("definitionName") String definitionName, 
     @PathVariable("attributeName") String attributeName, 
     HttpServletRequest httpRequest, 
     HttpServletResponse httpResponse) throws ServletException, IOException { 


    ApplicationContext tilesContext = ServletUtil.getApplicationContext(httpRequest.getSession().getServletContext()); 
    TilesContainer tilesContainer = getTilesContainer(tilesContext); 
    ServletRequest servletRequest = new ServletRequest(tilesContext, httpRequest, httpResponse); 
    String templatePath = getTemplatePath(tilesContext, definitionName, attributeName, tilesContainer, servletRequest); 
    InputStream templateStream = loadResourceInputStream(templatePath, tilesContext); 
    IOUtils.copy(templateStream, httpResponse.getOutputStream()); 
} 

Spring.addDecoration(..)看起来有趣!我需要阅读更多内容......