【问题标题】:Apache tiles using spring mvc使用spring mvc的Apache瓷砖
【发布时间】:2017-07-15 09:27:46
【问题描述】:

我有一个评论图块我想刷新只是添加的评论而不是所有评论 我的代码是:

<definition name="accueil" extends="new.definition">
     <put-attribute name="showAllPub" value="/WEB-INF/pages/showAllPub.jsp"/>
     <put-attribute name="tileCommentPub" value="/WEB-INF/pages/allPub/tileCommentPub.jsp"/>
</definition>

我可以将名称 TileCommentpub 与 -${p.commentId} 连接起来吗 只刷新添加的评论?
如果是,我如何将评论 ID 传递给 tiles.xml?
谢谢

【问题讨论】:

    标签: jsp spring-mvc apache-tiles


    【解决方案1】:

    我可以将名称 TileCommentpub 与 -${p.commentId} 连接起来吗

    很遗憾没有;磁贴只是在部署时创建的固定模板,您可能直到运行时才知道评论 ID。

    也许这会有所帮助;把你的评论放到tileCommentPub.jsp;

    .... your existing comment jsp code ....
    <p>Comment ID is : ${p.commentId}</p>
    <p>For example : ${comment.text}</p>
    

    并从您的控制器注入评论特定数据;

    @RequestMapping
    public String getSomePageWithComment (final Model model) {
        // ... get the comments...
        model.addAttribute("comment", comment);
        model.addAttribute("p", p);
        return "tileCommentPub";
    }
    

    【讨论】:

      猜你喜欢
      • 2017-08-28
      • 2011-07-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多