History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: SIM-201
Type: New Feature New Feature
Status: Open Open
Assignee: Unassigned
Reporter: Cuong Hoang
Votes: 4
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
SiteMesh

JSF View Handler for SiteMesh

Created: 16/Jan/06 08:06 PM   Updated: 28/Feb/07 03:55 AM
Fix Version/s: None

File Attachments: 1. Zip Archive SMViewHandler.zip (6 kb)



 Description  « Hide
Please refer to <a href="http://forums.opensymphony.com/thread.jspa?threadID=13549">this post</a>.

The code has plenty room for improvement and I hope someone will be interested in doing that.

Usage:

+You can drop the unzipped folder in sitemesh source folder and do a rebuild.
+Add the following to your web.xml:

<filter>
        <filter-name>sitemesh</filter-name>
        <filter-class>net.climbingrose.sitemesh.filter.SMInitFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

+In your faces-config.xml:

<view-handler>
net.climbingrose.sitemesh.jsf.SMViewHandlerImp
</view-handler>


 All   Comments   Change History      Sort Order:
Jomar L - [07/Mar/06 04:19 PM ]
What version of Myfaces are you using?

I get this nullpointerexception trying out this on tomcat 5.5:


2006-03-07 23:09:54,453 ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/test].[Faces Servlet] - Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
at net.climbingrose.sitemesh.jsf.SMViewHandlerImp.renderView(SMViewHandlerImp.java:110)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:292)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:79)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:143)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:246)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:220)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:173)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
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.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
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:667)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)

it seems like the initSMFactory dont inialize the factory.

Cuong Hoang - [07/Mar/06 05:17 PM ]
Hi,

I'm using Tomcat 5.0.28 with all MyFaces version from 1.1.1. Make sure that you have the filter set up properly in your web.xml:

<filter>
        <filter-name>sitemesh</filter-name>
        <filter-class>net.climbingrose.sitemesh.filter.SMInitFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

Jomar L - [14/Mar/06 06:13 AM ]
Hi,

thanks, problem solved.

Have you got this working with subviews? This is the main problem we have with sitemesh + jsf, you can only decorate
one view, or several views if only one of them contains any form-encapsulated tags.

Example decorator:

<div id="pageHeader">
   <decorator:getProperty property="page.header"/>
   <page:applyDecorator page="/header.jsp" name="panel" title="header">
</div>

<div id="pageBody">
  <decorator:body />
</div>

If I have some commandLinks or other JSF components that needs to be encapsulated in a :form in header.jsp, these
will be decorated, but they will not submit correctly, and just refresh the current view.

It seems like noone have managed to solve this problem, yet.

Marthin Vandez - [20/Sep/06 03:15 AM ]
hi
does any one come to a complete solution for Sitemesh and JSF ?
i am really stucked with sitemesh and JSF , i remember that Struts and SiteMEsh was charming and now i am dead with making it work with jsf.

one big problem is that i can not compile the code that user provided here , it sayd that i can not find Factory class ,

by the way do you get it fully working at Jomar ?

Matt Raible - [11/Oct/06 10:37 PM ]
It doesn't look this one works with Facelets since Facelets has it's own ViewHandler. Any idea how hard it would be to make it Facelets-friendly?

Thanks,

Matt

Shawn Garner - [28/Feb/07 03:55 AM ]
I was able to get this working with MyFaces 1.1.5, Tomcat 5.5.9, and the Sitemesh 2.3 jar.
I followed the instructions and it worked first time.

Should add this to the Sitemesh 2.3 jar and add it to the documentation.
It took me forever to find this and Sitmesh 2.3 jar wasn't even on the OpenSymphony website yet.

Shawn