使html表行可单击以调用servlet?

时间:2013-10-01 10:57:17

标签: java html jsp servlets

我想在点击表格行时调用servlet。我尝试了几种方法,但没有一种方法是正确的。 这是我的jsp表和我尝试的内容:

        <th>DESCRIPTION</th>

        <th>PRICE</th>
        <th>IMAGE</th>

    </tr>
</thead>
    <c:forEach var="employee" items="${allads}">

        <tr onclick="document.location ="datail_ad_viewer?page=${employee.brand}";">
            <td><a href="datail_ad_viewer?page=${1}"></a></td>
            <td>${employee.description}<br/>${employee.location}<br/>${employee.brand}          </td>

            <td>${employee.price}</td>
            <td width="150"><center><img height="80" width="120"     onerror="this.src='http://localhost:8080/images/default.png';" src=${employee.imageurl} />    </center></td>

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

1 个答案:

答案 0 :(得分:1)

不要试图嵌套双引号!对于内部或外部字符串,请使用'而不是"。像这样:

onclick="document.location='datail_ad_viewer?page=${employee.brand}';"