|
Hi! I have a problem with using <jsp:include> on my JSF
pages. I am sorry for having created an JIRA issue () before asking here on the
user mailing list (I’ve not known about this mailing list). Okay, so here
is my problem: I am having many pages, with one master page (in this
example test.jsp). In my real world application, the master page is including
other JSF pages. The page to include is determined by a String property of a
session bean. So, when a user clicks on a link in the navigation menu, a property
in a session bean is set and the next time the page is loaded, this page
get’s included, rendered, and sent to the client. (In my example I am
including 2 different pages 0.jsp and 1.jsp depending on Math.random() to
simulate what I want to do in my real world application). This worked fine for some time, but in the last weeks
I’ve watched some strange behavior. Some elements (like
<h:outputText/>, …) have been rendered twice, or in the wrong
order, … and sometimes there was a duplicate_id exception… So I
tried to figure out what is going wrong and realized, that there is something
about the <jsp:include>. If I use JSP include for one page… (for
example 1.jsp) … and in the next request I am including the same page,
and in the next request the same page, and so on… everything works as
expected, but when I include another page, this strange behaviour occurs… I am not sure about what the problem is and I’ve read
the JSF Reference implementation and I think I’ve done everything like
described there. I’ve attached a very very simple example of what I am
trying to do. You have to click on the button some times, until another page
gets rendered, and you can see, that the BEFORE and AFTER label are positioned
wrong ! (The MMMMMM label has to be between them). I’ve removed the
libraries in my example to keep it small. I’ve used Sun RI because
it’s the same problem that I have when using MyFaces (In my real world
application I am using MyFaces (And I really like it!!!)). Okay, I hope you can help me, because I am already very
frustrated…. Thanks for your help in advance, (If you need anything,
please let me know) Dominik Because I was not able to attach my file, here are the files
and there contents: --- Test.jsp (This is the first page) <%@ page contentType="text/html;
charset=Cp1252" %> <%@ taglib uri="http://java.sun.com/jsf/html"
prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core"
prefix="f"%> <% long i = Math.round(Math.random()); %> <html> <head><title>test_ri</title></head> <body> <f:view> <h:panelGrid
width="100%" columns="1"> <jsp:include
page='<%= "" + (i++) + ".jsp" %>'/> <h:outputText
value="before"/> <jsp:include
page='f.jsp'/> <h:outputText
value="after"/> </h:panelGrid> </f:view> </body> </html> --- f.jsp <%@ taglib uri="http://java.sun.com/jsf/html"
prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core"
prefix="f"%> <f:subview id="pagef"> <h:panelGrid columns="1"
width="100%"> <h:outputText
value="MMMMMMMMMMMMMMMM"/> </h:panelGrid> </f:subview> --- 1.jsp <%@ taglib uri="http://java.sun.com/jsf/html"
prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core"
prefix="f"%> <f:subview id="page1"> <h:panelGrid> <h:outputText value="hi
1"/> <h:form> <h:commandButton
value="hi"/> </h:form> <h:outputText value="hi
2"/> <h:outputText value="hi
3"/> <h:outputText value="hi
4"/> <h:outputText value="hi
5"/> </h:panelGrid> </f:subview> --- 0.jsp <%@ taglib uri="http://java.sun.com/jsf/html"
prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core"
prefix="f"%> <f:subview id="page0"> <h:panelGrid> <h:outputText value="ZERS
asdfasdf"/> <h:form> <h:commandButton
value="hi"/> </h:form> </h:panelGrid> </f:subview> |
- Problem with <jsp:include/> Bieringer, Dominik
- Re: Problem with <jsp:include/> Jordan Laughlin
- RE: Problem with <jsp:include/> Bieringer, Dominik
- RE: Problem with <jsp:include/> Bieringer, Dominik
- RE: Problem with <jsp:include/> Bieringer, Dominik
- RE: RE: Problem with <jsp:include/> Bieringer, Dominik
- Re: Problem with <jsp:include/> Jeff Bischoff
- RE: Problem with <jsp:include/> Bieringer, Dominik
- Re: Problem with <jsp:include/> Jeff Bischoff

