Jsp include problem in websphere


Web tier: servlets, JSP, Web frameworks: Jsp include problem in websphere

  1. Hi All,

    I am trying to include a jsp page in another jsp page. it works fine for me in weblogic but not in websphere. I am trying to send a parameter also. All suggestions are welcomed

    <jsp:include page="2.jsp" flush="true" >
    <jsp:param name="param_value" value="secondpage" />

    This code works perfectly in weblogic. when i try to run the same page in websphere it give error saying UNTERMINATED jsp:include.

    After working on this problem with some time i came to know that websphere doesnot support
    </jsp:include> so i modified the above code to
    <jsp:include page="2.jsp" flush="true" />
    <jsp:param name="param_value" value="secondpage" />

    now i dont get UNTERMINATED jsp:include error but param_value is null in 2.jsp

    please help.

  2. Unfortunately, it sounds like you have an older implementation of websphere that doesn't support body tags in the <jsp:include> tag.

    When I first started learning JSP, I didn't even know about the <jsp:param> tag, and instead I did this:

    <% request.setAttribute("title", "My Home Page");
    <jsp:include page="/WEB-INF/jsp/header.jsp" flush="true" />

    in the header.jsp file, I did this:

    <%= request.getAttribute("title") %>

    I know it's not a elegant solution, but unless you figure out why your websphere can't handle it, then this is the only way that I can think of that will make it compatible across both servers.