Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF and sitemesh problem

843844Oct 2 2007 — edited Oct 2 2007
Hi all, does anyone know if there is a problem using JSF code/tags in sitemesh/decorator files?

I have a simple decorator file, and within this i try to add some JSF code <f:view> .. </f:view> But i always get this error message. (See bellow).
JSF do work in my other files (Those displayed through the body tag, <decorator:body/>), but its in the decorator file itself that it doesn't work for me.

Im using:
myfaces, 1.1.5
sitemesh, 2.2.1
Tomcat 5.5


------------------------------------------------------------
javax.faces.FacesException: Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml configuration fileand if you are accessing your jsf-pages through the correct mapping. E.g.: if your FacesServlet is mapped to *.jsf (with the -element), you need to access your pages as 'sample.jsf'. If you tried to access 'sample.jsp', you'd get this error-message.
at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:926)
at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:313)
at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:73)
at org.apache.jsp.decorators.default_jsp._jspx_meth_f_005fview_005f0(default_jsp.java:341)
at org.apache.jsp.decorators.default_jsp._jspService(default_jsp.java:167)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

----------------------------------------------------------------------------

--------------------------- web.xml----------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name>test</display-name>

<!-- [INSERT FRAGMENT HERE] -->
<!-- Define the basename for a resource bundle for I18N -->
<context-param>
<param-name>
javax.servlet.jsp.jstl.fmt.localizationContext
</param-name>
<param-value>MessageResource</param-value>
</context-param>

<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>
org.springframework.web.filter.CharacterEncodingFilter
</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>


<filter>
<filter-name>lazyLoadingFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
</filter>


<filter>
<filter-name>sitemesh</filter-name>
<filter-class>
com.opensymphony.module.sitemesh.filter.PageFilter
</filter-class>
</filter>


<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext*.xml</param-value>
</context-param>

<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>lazyLoadingFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>


<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>


<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

<listener>
<listener-class>
org.apache.myfaces.webapp.StartupServletContextListener
</listener-class>
</listener>

<servlet>
<servlet-name>faces</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>faces</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>


</web-app>
---------------------------------------------------------------------------------
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 30 2007
Added on Oct 2 2007
1 comment
511 views