<jsp:setProperty name="firstBean" property="sifre" /><br/>
<c:choose>
<c:when test="${firstBean.sifreKntrl()}">
Hosgeldin!
</c:when>
<c:otherwise>
<meta http-equiv="refresh" content="3;firma.html">
</c:otherwise>
</c:choose>
当我通过 <% %> 语法使用 if else 条件 时,它会起作用,但我无法使用 else 条件重定向到另一个页面。由于指令问题,我使用了 EL,但现在我无法使代码工作。这使得作品具备了这两个条件。
最佳答案
您可以使用重定向标记来执行此操作。下面的代码对我有用。
<c:choose>
<c:when test="CONDITION">
<c:redirect url="PAGE1.jsp"/>
</c:when>
<c:otherwise>
<c:redirect url="PAGE2.jsp"/>
</c:otherwise>
</c:choose>
关于java - JSP中如何定向另一个页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59331687/