在jsp中实现视图详细信息页面

时间:2015-11-30 10:04:06

标签: jsp

大家好,我有一个学校项目,我不知道我在做什么。

<c:forEach var="recipe" items="${recipeResults}" varStatus="roop">
          <tr>
            <td width="20%">${recipe.name}<script>var model=${recipe.name}; </script></td>
            <td>
              <img src = "${recipe.pictureAddress}" class = "img-rounded center-block"  width="240">
            </td>
            <td width="60%">${recipe.description} <button type="button" class="btn btn-warning" id="viewDetail" data-toggle="modal" data-target="#myModal">View</button></td>
          </tr>
        </c:forEach>

它适用于列出用户的所有食谱,但是当用户点击查看详细信息按钮时,我不知道如何保留这些特定食谱,然后显示有关此食谱的所有信息。谢谢

1 个答案:

答案 0 :(得分:0)

<button type="button" class="btn btn-warning" onclick="getModal(this)" data-description="${recipe.description}">View</button>

data-attribute用于您需要的所有内容

function getModal(el) {
    $("#description").val($(el).data("description"));
    ...

    $("#myModal").modal('toggle');
}
相关问题