2

我意识到关于这个特定主题有很多问题,但我已经尝试了每一个解决方案,但它们并不完全有效。或者我做错了什么,如果看到请指出。

所以我有一个 Spring MVC 应用程序,其中包含实现 Twitter Bootstrap 的 JSP 页面。在其中一个中,我得到了一张由 JSTLforEach循环填充的表格。这是我似乎无法让它工作的地方。这是我得到的:

<table class="table table-hover" data-provides="rowlink">
    <thead>
        <tr>
            <th>Title</th>
            <th>Author</th>
            <th>Last Mod</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <c:forEach var="recipe" items='${recipes}'>
            <tr>
                <td><a href="/recipes/${recipe.id}">${recipe.inputTitle}</a></td>
                <td>${recipe.author}</td>
                <td>${recipe.timestamp}</td>
                <td><a class="btn btn-small btn-primary" href="/recipes/${recipe.id}"><i class="icon-list icon-white"></i> Detalhe</a></td>
            </tr>
        </c:forEach>
    </tbody>
</table>

这样做基本上是在第一个字段(标题)上添加一个链接,它不会让整行都可点击。另外,如果您知道我的意思,我想是否可以不出现类似链接。

我也尝试过<tbody data-provides="rowlink">,几乎所有我在 SO 上存在的所有答案中看到的各种组合。

我错过了什么?

谢谢

编辑

some1 能否指出正确的方法是什么?也许我错过了一些东西。

谢谢

编辑 2

感谢@SlavaSemushin ,我设法让整行可点击,class="rowlink" to the在循环中添加`:

    <table class="table table-bordered table-striped" data-provides="rowlink">
        <thead>
            <tr>
                <th>Title</th>
                <th>Author</th>
                <th>Last Mod</th>

            </tr>
        </thead>
        <tbody>
            <c:forEach var="recipe" items='${recipes}'>
                <tr class="rowlink">
                <a href="/recipes/${recipe.id}">
                    <a href="/recipes/${recipe.id}">${recipe.inputTitle}</a></td>
                    <td>${recipe.author}</td>
                    <td>${recipe.timestamp}</td>

                </a>
                </tr>
            </c:forEach>
        </tbody>
    </table>

我尝试将其添加class="nolink"到提供<td>链接的位置,并尝试将其添加到<tr>我放置的位置class="rowlink",但无论哪种方式都不起作用。

所以解决了整行可点击的问题,我只想删除第一个表字段上的链接突出显示。

4

0 回答 0