Hi all,

Can anyone guide me how to create JSP page on condition. I'm trying to call two different .jsp pages in one index.html page. I tried different conditions to achieve this bt did not succesed. Kindly help me. Its urgent.

Recommended Answers

All 2 Replies

start with a index.jsp page, instead of a .html page. html is static, not dynamic.
then, in the servlet of your action, choose, based on the conditions you pass, what url to go to.

You can use JSTL tag library.
Import it:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

and then you can call "if" method from taglib:

<c:choose>
    <c:when test="${ok}">
        ...
    </c:when>
    <c:otherwise>
        ...
    </c:otherwise>
</c:choose>

You have much more examples on this link.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.