【问题标题】:draw html in java not javascript在java而不是javascript中绘制html
【发布时间】:2018-11-14 10:21:30
【问题描述】:

假设我有

@RequestMapping(value = "/app/minfoManagementdetail.do", method = RequestMethod.POST)
    public String detailMinfoManagementPost(@ModelAttribute("searchPageNavigationVO") SearchAppVO searchAppVO, 
            HttpServletRequest request, Model model) throws Exception {

        List<EgovMap> attachList =  (List<EgovMap>) amtAppMonitAtchFileService.selectAppMonitAtchFiles( searchAppVO.getFindMonitSn());


}

我想在 minfo.jsp 中绘制这个附加列表

<div class="attachFileList" id="attachFileList" style="display: none;"></div>

其实我也想做这个

for (i = 0; i < Object.keys(resultDetail.amtBrdTblAtch).length; i++) {
    html += "<a href='/file/download.do?type=brd&sn="+resultDetail.amtBrdTblAtch[i].atchFileSn+"'>"+resultDetail.amtBrdTblAtch[i].orgFileNm+"</a><br/>";
                                }
$("#attachFileList").html(html);

java 中的动作不在 javascript 中。 有可能吗?

【问题讨论】:

  • 只是想知道任何 javascript 人知道怎么做
  • 所以你想使用java在服务器端设置一个元素的内部html?
  • 是的,我想用 java 访问 html

标签: java html jsp dom web


【解决方案1】:

我真的更喜欢发送对象数据并将其呈现在 .jsp 文件中,因为这正是 JSTL 存在的目的。除非您异步执行此操作。在这种情况下,您可能需要考虑使用模板框架(例如 Thymeleaf 用于 Spring 或 VueJS 用于 js)并将 DOM 的一部分呈现为片段,或者仅使用 js 附加结果。

希望对你有用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多