[Beginner][Solved] Problem with jsp:include Tag
[Logo]
ICEsoft.org Forums: ICEfaces, ICEmobile, ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icesoft.org  [Login] Login 
[Beginner][Solved] Problem with jsp:include Tag  XML
Forum Index -> Components
Author Message
Baleyba

Joined: 16/11/2006 00:00:00
Messages: 110
Offline


Hi,

I have a problem with the <jsp:include> tag.

My main page works perfectly.
but when I use the <jsp:include> tag, the included jsp get this error: Cannot find FacesContext

15:42:38,068 INFO [STDOUT] 15:42:38,068 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Cannot find FacesContext
at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:427)
at com.icesoft.faces.component.ext.taglib.PanelGridTag.doStartTag(PanelGridTag.java:606)
at org.apache.jsp.pages.inc.accueil_jsp._jspx_meth_ice_panelGrid_0(accueil_jsp.java:88)
at org.apache.jsp.pages.inc.accueil_jsp._jspService(accueil_jsp.java:64)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
 


Here is an example of code.
The Main file:
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://www.icesoft.com/icefaces/component" prefix="ice"%>

<f:view>
<html>
<ice:outputDeclaration doctypeRoot="HTML" doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN" doctypeSystem="http://www.w3.org/TR/html4/loose.dtd" />

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Title</title>

</head>

<body>
<ice:panelBorder layout="hide east" border="0" cellpadding="0" cellspacing="0" styleClass="mainBorderLayout">

<f:facet name="north">
<ice:panelGroup>
<jsp:include page="/inc/header.iface" />
</ice:panelGroup>
</f:facet>
.
.
.
.
.
</ice:panelBorder>


</body>
</html>
</f:view>

 

And the included "header" file:
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://www.icesoft.com/icefaces/component" prefix="ice"%>

<ice:form id="header" >

<ice:panelGrid style="width:100%">

<ice:menuBar id="menu" orientation="horizontal">

<ice:menuItem id="application" value="File">

.
.
.
.


</ice:panelGrid>
</ice:form> 


Thanks a lot for you help

regards,
Bal.

JBoss 4.2.3 | Java 1.6.0_16 | IceFaces 1.8.2
philip.breau


Joined: 08/05/2006 00:00:00
Messages: 2701
Offline


Hi Bal,

I think what's happening here is that you're trying to display the page as a JSP, not through JSF. To invoke the JSF servlet, you have to use a URL to call the page that will be caught by the JSF servlet mapping defined in your web.xml. Usually, we use *.iface for the ICEfaces Persistent Faces Servlet. When you go through a JSF servlet like this, the JSF framework should be properly initialized, and you won't receive the "Cannot find FacesContext" error.

Cheers,
Philip

.
Baleyba

Joined: 16/11/2006 00:00:00
Messages: 110
Offline


Ok, thanks for your answer.
I understand what you mean, but see my code. I'm using ".iface" extension. So I don't understand...

In fact, before I was using XML syntax. And now I use "<@ taglib" declaration for having autocompletion wity MyEclipse.

So before I was using: Code:
<jsp:directive.include file="/inc/header.jsp" />
and it was ok.

After researchs, I'm trying Code:
<%@ include file="/inc/header.jsp" %>
for the jsp syntaxx but :( ...

JBoss 4.2.3 | Java 1.6.0_16 | IceFaces 1.8.2
Baleyba

Joined: 16/11/2006 00:00:00
Messages: 110
Offline


Hi,

All is ok. I found the problem.

I must use:
<%@ include file="./pages/inc/header.jsp" %> 


I had forgotten the begining of the relative URL: "./pages"

Thanks
Bal.

JBoss 4.2.3 | Java 1.6.0_16 | IceFaces 1.8.2
 
Forum Index -> Components
Go to:   
Powered by JForum 2.1.7ice © JForum Team