首页 > 解决方案 > 在 JSP 中使用 JavaScript 取消隐藏 HTML 行

问题描述

在 Spring MVC 中使用服务器数据显示 JSP 页面,我将数据从 Spring 发送到 JSP 页面,并且基于数据对象值需要取消隐藏另一行。

我的 JSP 页面的一部分:

<tr>
    <td align="center"><select style="width: 300px" id="menu6" name="menu6" size=10 multiple>
        <c:forEach var="categoryTwo" items="${dataObj.categorySubcategoryNameAndIds}" >
            <option value="${categoryTwo.categoryTypeId}" categoryType="${category.categoryTypeId}" >${categoryTwo.feedCategoryOrSubCategoryName}</option>
        </c:forEach>
    </select><br /></td>
</tr>

<tr id="newRow" style="display: None">
    <td>
        something to show
    </td>
</tr>

显示的数据来自服务器,是一个对象列表,基于一个对象成员的值,即 categoryType(int variable) 我必须取消隐藏 id='newRow' 的行。

问题是,我无法弄清楚将 categoryType 值推送到 javascript 函数的方法。

categoryType 的值应为 5 以取消隐藏 id='newRow' 的行

标签: javascripthtmlspring-mvcjsp

解决方案


推荐阅读