tags:

views:

72

answers:

3

Hi All:
I have added a code which will include child jsp using jsp:include. The problem i am facing is that the code present in child code is not executing. Below is the code iam using it now

JSPF File:

       <jsp:include page="X.jsp" flush="true">
   </jsp:include>

the above code is present in a file named "A.jspf" which is included in another jsp file named "Parent.jsp".

X.jsp:

      <%@ page import="java.util.*" %>
      <%
         System.out.println("********Child JSP");
       %>

Whenever i execute the parent file "Parent.jsp", all the other contents given in Parent.jsp and A.jspf is displaying except the content present in X.jsp. No error is displaying. Both X.jsp and A.jspf are present in same folder only. Please help me to resolve this issue. Thanks in advance.

+1  A: 

If you want the string to be displayed in the client's browser, you should use this instead :

<%@ page import="java.util.*" %>
<%
    out.println("********Child JSP");
%>

System.out.println() will output the string in your webserver's console, whereas out.println() will use the JSP's implicit "out" object that represents the http response's output stream - therefore correctly outputting the given String in the web page.

Olivier Croisier
I have tried with "out.println("********Child JSP");" also but still it couldn;t display anything in that page..
raja
Any success with static inclusion ? <%@include file="X.jsp" %>
Olivier Croisier
A: 

Try this in your child jsp:

<%="********Child JSP"%>

Use <%=..%> less verbose tag to print on your jsp.

Check this card for quick reference.

systempuntoout
I have tried but doesn't work....
raja
Long time i don't use jsp but i'm quite sure that's the right syntax.Try to restart you application server or touch the parent jsp.
systempuntoout
A: 

If you're modifying the child JSP, modify the parent JSP once and save it. It may be as trivial as adding/removing a space. This results in the servlet getting built again.

When you make changes in a static include, it does not reflect until the parent jsp is compiled again.

Vaishak Suresh