Using MyFaces on Tomcat 5.5 I tried a very basic example where I have one JSP (itest.jsp) page that only contains a single line:
The referenced jsf file only contains a <f:view> en some <h utputText> elements. What happens is a bizare kind of recursion. A couple of hundred lines appear in my log. It start with 10's of:
Then the following pattern which is also repeated hundreds of lines:
For some reason the JSF servlet causes a call to my jsp page again after the include tag has been processed. I'm not really sure why this happens. Is there a 'rule' somewhere that sais I'm not allowed to do this? I'm aware of the fact that JSTL and JSF are a bad mix, but I've never read anything about jsp:include in this situation.
For using jsp:include inside a jsf page, the subview tag needs to be used. Although this is not exactly the same situation, I nevertheless tried that. But this also did not help and again the weird kind of recursion happened. [ February 03, 2006: Message edited by: Saskia de Jong ]
I think the issue here is that the include doesn't issue or create an http request. Thus it isn't filtered through the faces servlet. Hence your .jsf isn't read by the servlet as it is included.
Then if you include the jsf in the jsp, but then call the the itest.jsp instead of itest.jsf it doesn't get filtered by the servlet either. So the faces tags included by jsftest2.jsp (or in your case jastest2.jsf) are not interpreted by the faces servlet either. Since jsp are not filtered through it.
Originally posted by Gerardo Tasistro: I think the issue here is that the include doesn't issue or create an http request. Thus it isn't filtered through the faces servlet. Hence your .jsf isn't read by the servlet as it is included.
I'm not really sure if that is the issue. If I look at the given stack trace I see a "at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)" line there, so the include surely causes the JSF servlet to be invoked.
I quickly tried the same setup (also tomcat and myfaces), and there's indeed an endless recursion happening. I also tried your solution and it did work, so the OP's problem is solved I think. Nevertheless I'm curious about what is exactly happening here.
It would be interesting to step through the tomcat source (JspServlet would be a candidate) with a debugger to get to the bottom of this. Maybe if I'll have some time tomorrow I'll try to do this.