• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsf in a jsp:include doesn't work?

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you try /jsftest2.jsf, but not /jsftest2.jsp ?
 
Saskia de Jong
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sergey Smirnov:
Why do you try /jsftest2.jsf, but not /jsftest2.jsp ?



Since jsftest2.jsp is a file containing JSF tags. If I use the name jsftest2.jsp in the include tag, then it's not going through the JSF servlet. In my setup *.jsf files are mapped to the JSF servlet.

Nevertheless I did try to use jsftest2.jsp, but then I just get a msg that JSF is not initialized.
 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Try this. Do the include as:

<jsp:include page="/jsftest2.jsp" />

Note that I'm calling jsp NOT jsf

Then open

itest.jsf NOT itest.jsp

in the browser

and see what happens. Hope that fixes it.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Replace the word "snake" with "danger noodle" in all tiny ads.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic