在位于我的 jsp 页面的目录中,
webapp/WEB-INF/views我想从 1.jsp 转发到 2.jsp
在 1.jsp 我写
<a href="2.jsp?id=${candidate.id}">${candidate.name}</a>
但它不起作用。如何解决?
A relative url should start with a / character
Change the anchor tag as below and try again
<a href="/2.jsp?id=${candidate.id}">${candidate.name}</a>
使用<c:url,然后将value属性<c:url设置为href到其他 JSP 的链接。例如,它将是:
<a href="<c:url value="2.jsp?id=${candidate.id}" />">${candidate.name}</a>
我在我的 webapps 中以以下方式使用它(其中电路是 下的文件夹/WEB-INF/views):
<a href="<c:url value="/circuits/${circuit.circuitId}/edit" />">Edit Circuit</a>