Sitemesh with JSF

View: New views
6 Messages — Rating Filter:   Alert me  

Sitemesh with JSF

by Ingoba () :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I am new to Sitemesh. I am using it with JSF. I have written a page and code is as follows:

<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/page" prefix="page"%>



<html>
    <head>
        <title>Configuration profile page</title>
        <decorator:head />
    <link href="/css/ss.css" rel="stylesheet" type="text/css"/>
    <link href="/css/ss_dbs.css" rel="stylesheet" type="text/css"/>
    <link href="/css/dbs.css" rel="stylesheet" type="text/css"/>
   
    </head>
 
    <body>
    <table border="0" width="100%" height="80%">
    <tr>
    <td width="100%"  colspan="2" height="15%">
                                        <page:applyDecorator page="/tiles/header.jsp" name="header" title="header"/>               
                                </td>
    </tr>
    <tr>
    <td width="20%" height="60%" valign="top">
    <page:applyDecorator page="/tiles/menu.jsp"  name="menu" title="menu"/>    </td>
    <td  width="80%" height="60%" valign="top">
    <decorator:body/>
    </td>
    </tr>
    <tr>
    <td  colspan="2"  width="100%" height="5%">
    <page:applyDecorator page="/tiles/footer.jsp"  name="footer" title="footer"/>    </td>
    </tr>
    </table>
    </body>
</html>

But when I try to run this page, I got the error as :

java.lang.RuntimeException: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: org.apache.jasper.JasperException: java.lang.NullPointerException
        com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:40)
        com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)

The problem is in importing the header, menu and footer pages(having JSF code). if replaced it with some other html code(not JSF code), it is working fine.

Please help me.

Thanks,
Ingoba

Re: Sitemesh with JSF

by Joe Walnes-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ingoba

It's hard to say what the problem is from this. To help me understand
this, please let me know:
* the contents of your decorator.xml file (and your sitemesh.xml file,
if you have one)
* the file name of this decorator
* the url being requested
* the full stack trace (leave it all intact)

thanks
-Joe

On Mon, Jun 8, 2009 at 6:54 AM, Ingoba<ingoba.ningthouja@...> wrote:

>
> Hi,
> I am new to Sitemesh. I am using it with JSF. I have written a page and code
> is as follows:
>
> <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator"
> prefix="decorator" %>
> <%@ taglib uri="http://www.opensymphony.com/sitemesh/page" prefix="page"%>
>
>
>
> <html>
>    <head>
>        <title>Configuration profile page</title>
>        <decorator:head />
>        <link href="/css/ss.css" rel="stylesheet" type="text/css"/>
>        <link href="/css/ss_dbs.css" rel="stylesheet" type="text/css"/>
>         <link href="/css/dbs.css" rel="stylesheet" type="text/css"/>
>
>    </head>
>
>    <body>
>        <table border="0" width="100%" height="80%">
>                <tr>
>                        <td width="100%"  colspan="2" height="15%">
>                                        <page:applyDecorator page="/tiles/header.jsp" name="header"
> title="header"/>
>                                </td>
>                </tr>
>                <tr>
>                        <td width="20%" height="60%" valign="top">
>                                <page:applyDecorator page="/tiles/menu.jsp"  name="menu"
> title="menu"/>
>                        </td>
>                        <td  width="80%" height="60%" valign="top">
>                                <decorator:body/>
>                        </td>
>                </tr>
>                <tr>
>                        <td  colspan="2"  width="100%" height="5%">
>                                <page:applyDecorator page="/tiles/footer.jsp"  name="footer"
> title="footer"/>
>                        </td>
>                </tr>
>        </table>
>    </body>
> </html>
>
> But when I try to run this page, I got the error as :
>
> java.lang.RuntimeException: org.apache.jasper.JasperException:
> javax.servlet.ServletException: javax.servlet.jsp.JspException:
> org.apache.jasper.JasperException: java.lang.NullPointerException
>
> com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:40)
>
> com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
>
> Please help me.
>
> Thanks,
> Ingoba
> --
> View this message in context: http://www.nabble.com/Sitemesh-with-JSF-tp23918560p23918560.html
> Sent from the OpenSymphony - SiteMesh mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Sitemesh with JSF

by Ingoba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Joe.
1. The content of decorator.xml is:

<?xml version="1.0" encoding="UTF-8"?>

<decorators defaultdir="/decorators">
        <!-- Decorator for pages which need Sidemenu -->
    <decorator name="sidemen" page="/jsp/sidemenu.jsp">
        <pattern>/xforms-jsp/*</pattern>
    </decorator>
   
    <decorator name="profile" page="/jsp/createpage.jsp">
        <pattern>/jsp/*</pattern>
    </decorator>
   
    <decorator name="profile" page="/jsp/createpage.jsp">
        <pattern>/*</pattern>
    </decorator>
       
    <excludes>
                <pattern>/images/*</pattern>
        </excludes>

</decorators>

2. The decorator page is (createpage.jsp):

<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/page" prefix="page"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<html>
    <head>
        <title>profile page</title>
        <decorator:head />
    <link href="../css/ss.css" rel="stylesheet" type="text/css"/>
    <link href="../css/ss_dbs.css" rel="stylesheet" type="text/css"/>
    <    
   
    </head>
   
   

    <body>
    <table border="1" width="70%" height="80%">
    <tr>
    <td width="70%"  colspan="2" height="15%">
                       
                         <page:applyDecorator page="header.jsp" name="header"/>
                </td>
    </tr><td><page:applyDecorator page="menu.jsp" name="menu"/></td>
   
    <td> <decorator:body /><td>
   
   
    <tr>
    <td  colspan="2"  width="70%" height="5%">
    <page:applyDecorator page="footer.jsp" name="footer"/></td>
    </tr>
    </table>
    </body>
</html>

3. The URL requested is :

     start the application with http://localhost:8080/myapp/faces/jsp/login.jsp
     
4. The stack trace is :

Jun 8, 2009 12:12:43 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.RuntimeException: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: org.apache.jasper.JasperException: java.lang.NullPointerException
        at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:40)
        at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:595)

Re: Sitemesh with JSF

by mraible :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You might look at the JSF version of AppFuse Light.


It uses MyFaces and SiteMesh.

Matt

On Mon, Jun 8, 2009 at 11:07 PM, Ingoba <ingoba.ningthouja@...> wrote:

Thanks Joe.
1. The content of decorator.xml is:

<?xml version="1.0" encoding="UTF-8"?>

<decorators defaultdir="/decorators">
       <!-- Decorator for pages which need Sidemenu -->
   <decorator name="sidemen" page="/jsp/sidemenu.jsp">
       <pattern>/xforms-jsp/*</pattern>
   </decorator>

   <decorator name="profile" page="/jsp/createpage.jsp">
       <pattern>/jsp/*</pattern>
   </decorator>

   <decorator name="profile" page="/jsp/createpage.jsp">
       <pattern>/*</pattern>
   </decorator>

   <excludes>
               <pattern>/images/*</pattern>
       </excludes>

</decorators>

2. The decorator page is (createpage.jsp):

<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator"
prefix="decorator" %>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/page" prefix="page"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<html>
   <head>
       <title>profile page</title>
       <decorator:head />
   <link href="../css/ss.css" rel="stylesheet" type="text/css"/>
       <link href="../css/ss_dbs.css" rel="stylesheet" type="text/css"/>
        <

   </head>



   <body>
       <table border="1" width="70%" height="80%">
               <tr>
       <td width="70%"  colspan="2" height="15%">

                        <page:applyDecorator page="header.jsp" name="header"/>
               </td>
               </tr><td><page:applyDecorator page="menu.jsp" name="menu"/></td>

               <td>    <decorator:body /><td>


               <tr>
                       <td  colspan="2"  width="70%" height="5%">
                       <page:applyDecorator page="footer.jsp" name="footer"/></td>
               </tr>
       </table>
   </body>
</html>

3. The URL requested is :

    start the application with
http://localhost:8080/myapp/faces/jsp/login.jsp

4. The stack trace is :

Jun 8, 2009 12:12:43 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.RuntimeException: org.apache.jasper.JasperException:
javax.servlet.ServletException: javax.servlet.jsp.JspException:
org.apache.jasper.JasperException: java.lang.NullPointerException
       at
com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:40)
       at
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
       at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
       at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
       at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)

--
View this message in context: http://www.nabble.com/Sitemesh-with-JSF-tp23918560p23936424.html
Sent from the OpenSymphony - SiteMesh mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: Sitemesh with JSF

by Ingoba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
Please clarify me. Is it possible to write JSF code in decorator,menu, header and footer pages of SITEMESH? If it is possible can anybody help me. I tried but throws error.

Thanks,
Ingoba

Re: Sitemesh with JSF

by Joe Walnes-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ingoba

SiteMesh can be used to decorate sites built with JSF. However the it's not possible to use JSF in the actual decorators themselves as these are rendered after the JSF request lifecycle has ended. So you should build your content with JSF, but decorators with plain old JSP.

thanks
-Joe

On Thu, Jul 2, 2009 at 3:04 PM, Ingoba <ingoba.ningthouja@...> wrote:

Hi,
Please clarify me. Is it possible to write JSF code in decorator,menu,
header and footer pages of SITEMESH? If it is possible can anybody help me.
I tried but throws error.

Thanks,
Ingoba
--
View this message in context: http://www.nabble.com/Sitemesh-with-JSF-tp23918560p24307314.html
Sent from the OpenSymphony - SiteMesh mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...