简体   繁体   中英

How to direct another page in JSP?

    <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>

It works when I use if else condition by <% %> syntax but I am unable to redirect to another page with else condition. Because of directive problem I used EL but now I couldn't make the code worked. That makes works both of the conditions.

You can use the redirect tag to do so. The below code works for me.

<c:choose>
    <c:when test="CONDITION">
        <c:redirect url="PAGE1.jsp"/>
    </c:when>
    <c:otherwise>
        <c:redirect url="PAGE2.jsp"/>
    </c:otherwise>
</c:choose>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM