Skip to content Skip to sidebar Skip to footer

Include JSP On Menu Item Click

I have a main JSP page with the header and the footer, while the content of the pages is located in another JSP pages. I want to click on the menu item and load linked page via <

Solution 1:

I resolved with request object in this way:

In the JSP page:

<header>
<ul>
    <li><a href="?page=home">index</a></li>
    <li><a href="?page=search">search</a></li>
</ul>

<%if(request.getParameter("page").equals("home")){%>
    <jsp:include page="index.jsp">
 <%}else %>
    <jsp:include page="search.jsp">

That's it!


Post a Comment for "Include JSP On Menu Item Click"