8 Replies Latest reply on Feb 28, 2007 4:29 AM by hamtho2

    integration with Trinidad (ADF)

    lle

      Hi,

      Is there any of you successful in integrating Seam with Trinidad (ADF)? Seam reference document emphasizes on using Trinidad instead of Tomahawk. However, there is not much documentation or examples on how to integrate with this library.
      I followed the instructions on Trinidad Apache site and still get the following error when first accessing a page:

      SEVERE: Error Rendering View[/home.xhtml]
      java.lang.IllegalStateException: No RenderingContext
       at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:176)


      I checked my faces-config.xml many times and there's no duplicate config of view handler. I only defined it in web.xml.
      Is there anything else I should look into?
      Thanks a lot.

        • 1. Re: integration with Trinidad (ADF)
          pmuir

          Have you looked at the trinidad example on the wiki? Post your web.xml and faces-config.xml

          • 2. Re: integration with Trinidad (ADF)
            lle

            Hi,
            Yes, I followed the example on wiki and still got the exception. I checked my faces-config.xml many times and very sure there's no configuration of the view handler there, only in web.xml. Still got the exception...

            Here is my web.xml:

            <?xml version="1.0" encoding="UTF-8"?>
            <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
             <display-name>Risk Application</display-name>
            
             <context-param>
             <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
             <param-value>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</param-value>
             </context-param>
            
             <!-- Facelets with Trinidad configuration-->
             <context-param>
             <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
             <param-value>com.sun.facelets.FaceletViewHandler</param-value>
             </context-param>
             <!-- Use documents saved as *.xhtml -->
             <context-param>
             <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
             <param-value>.xhtml</param-value>
             </context-param>
            
            <!-- Use client-side state saving. In Trinidad, it is an
             optimized, token-based mechanism that is almost always a
             better choice than the standard JSF server-side state saving. -->
             <context-param>
             <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
             <param-value>client</param-value>
             <!--param-value>server</param-value-->
             </context-param>
            
             <!-- Trinidad by default uses an optimized client-side state saving
             mechanism. To disable that, uncomment the following -->
             <!--context-param>
             <param-name>org.apache.myfaces.trinidad.CLIENT_STATE_METHOD</param-name>
             <param-value>all</param-value>
             </context-param-->
            
             <context-param>
             <param-name>org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE</param-name>
             <param-value>false</param-value>
             </context-param>
            
             <context-param>
             <param-name>org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION</param-name>
             <param-value>true</param-value>
             </context-param>
            
             <!-- <context-param>
             <param-name>org.apache.myfaces.trinidad.CHANGE_PERSISTENCE</param-name>
             <param-value>session</param-value>
             </context-param> -->
            
             <!-- Special Debug Output for Development -->
             <context-param>
             <param-name>facelets.DEVELOPMENT</param-name>
             <param-value>true</param-value>
             </context-param>
            
             <context-param>
             <description>If true, rendered HTML code will be formatted, so that it is "human readable".
             i.e. additional line separators and whitespace will be written, that do not
             influence the HTML code.
             Default: "true"</description>
             <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
             <param-value>true</param-value>
             </context-param>
             <context-param>
             <description>If true, a javascript function will be rendered that is able to restore the
             former vertical scroll on every request. Convenient feature if you have pages
             with long lists and you do not want the browser page to always jump to the top
             if you trigger a link or button action that stays on the same page.
             Default: "false"</description>
             <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
             <param-value>true</param-value>
             </context-param>
            
             <!-- ajax4jsf filter - must be before any other filter -->
             <filter>
             <display-name>Ajax4jsf Filter</display-name>
             <filter-name>ajax4jsf</filter-name>
             <filter-class>org.ajax4jsf.Filter</filter-class>
             </filter>
            <!-- trinidad -->
             <filter>
             <filter-name>trinidad</filter-name>
             <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
             </filter>
             <!-- Propagate conversations across redirects -->
             <filter>
             <filter-name>Seam Redirect Filter</filter-name>
             <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
             </filter>
             <!-- Needed to ensure safe tx cleanup when using Seam-managed sessions/persistence contexts -->
             <filter>
             <filter-name>Seam Exception Filter</filter-name>
             <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
             </filter>
             <filter-mapping>
             <filter-name>trinidad</filter-name>
             <servlet-name>Faces Servlet</servlet-name>
             </filter-mapping>
             <filter-mapping>
             <filter-name>ajax4jsf</filter-name>
             <url-pattern>*.jsf</url-pattern>
             </filter-mapping>
             <filter-mapping>
             <filter-name>Seam Redirect Filter</filter-name>
             <url-pattern>*.jsf</url-pattern>
             </filter-mapping>
             <filter-mapping>
             <filter-name>Seam Exception Filter</filter-name>
             <url-pattern>*.jsf</url-pattern>
             </filter-mapping>
             <!-- Seam -->
             <listener>
             <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
             </listener>
             <!-- MyFaces -->
             <listener>
             <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
             </listener>
             <servlet>
             <servlet-name>Faces Servlet</servlet-name>
             <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
             <load-on-startup>1</load-on-startup>
             </servlet>
             <servlet-mapping>
             <servlet-name>Faces Servlet</servlet-name>
             <url-pattern>*.jsf</url-pattern>
             </servlet-mapping>
            
             <!-- trinidad resources servlet -->
             <servlet>
             <servlet-name>resources</servlet-name>
             <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
             </servlet>
            
            <!-- This cannot be configured currently -->
            <servlet-mapping>
             <servlet-name>resources</servlet-name>
             <url-pattern>/adf/*</url-pattern>
            </servlet-mapping>
            
             <!-- only allow developers to have access to the xhtml files -->
             <security-constraint>
             <display-name>Restrict XHTML Documents</display-name>
             <web-resource-collection>
             <web-resource-name>XHTML</web-resource-name>
             <url-pattern>*.xhtml</url-pattern>
             </web-resource-collection>
             <auth-constraint>
             <description>Only Let 'developer's access XHTML pages</description>
             <role-name>developer</role-name>
             </auth-constraint>
             </security-constraint>
             <login-config>
             <auth-method>BASIC</auth-method>
             </login-config>
            </web-app>
            


            • 3. Re: integration with Trinidad (ADF)
              lle

              here is my faces-config.xml:

              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
               "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
              <faces-config>
               <!-- Navigation rules for the risk app -->
               <navigation-rule>
               <navigation-case>
               <from-outcome>login</from-outcome>
               <to-view-id>/home.xhtml</to-view-id>
               <redirect/>
               </navigation-case>
               <navigation-case>
               <from-outcome>main</from-outcome>
               <to-view-id>/main.xhtml</to-view-id>
               </navigation-case>
               <navigation-case>
               <from-outcome>error</from-outcome>
               <to-view-id>/error.xhtml</to-view-id>
               <redirect/>
               </navigation-case>
               </navigation-rule>
              
               <application>
               <!-- Use the Trinidad RenderKit -->
               <default-render-kit-id>
               org.apache.myfaces.trinidad.core
               </default-render-kit-id>
               </application>
              
               <!-- Select one of the two standard persistence lifecycle models for the Seam application -->
               <lifecycle>
               <phase-listener>org.jboss.seam.jsf.TransactionalSeamPhaseListener</phase-listener>
               </lifecycle>
              </faces-config>


              • 4. Re: integration with Trinidad (ADF)
                atao

                Hello

                you are using Trinitad with a4j, so try with ajax4jsf 1.0.5 and a4j-trinidad.jar

                see https://ajax4jsf.dev.java.net/nonav/ajax/ajax-jsf/download.html#binary

                Regards

                • 5. Re: integration with Trinidad (ADF)
                  lle

                  Thanks for your response.

                  I did try the ajax-trinidad jar file. However, the example still occurs. I found out why, it is because the view handler of ajax4jsf exists in the web.xml file. I had to remove that one too for it to work. I put a wiki page under the Trinidad master page.
                  http://wiki.apache.org/myfaces/TrinidadSeamAjax4Jsf

                  Thanks.

                  • 6. Re: integration with Trinidad (ADF)

                    Is the a4j-trinidad.jar still necessary for ajax4jsf 1.0.6 or is it integrated into that package now?

                    I´m facing a similar issue but already use 1.0.6.

                    • 7. Re: integration with Trinidad (ADF)

                      BTW: this error only occures if using an ajax-rerender. Otherwise it works quite fine:

                      Example:

                       <h:dataTable var="profile" value="#{ProfileList}" rendered="#{ProfileList.rowCount>0}">
                      
                       <h:column>
                      
                       <a4j:commandButton id="command_link_up"
                       value="Delete"
                       reRender="profile, deleteConfirmation"
                       action="#{OverviewAction.registerPublisherProfile}" >
                       <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender" />
                       </a4j:commandButton>
                      
                      
                      <a4j:outputPanel id="deleteConfirmation" ajaxRendered="true">
                       <h:panelGroup id="deleteConfirmationPanel" rendered="#{OverviewAction.deleteRequested}" >
                       <div class="colored">
                       <tr:outputText value="#{messages['deleteProfile.confirmationText']}" />
                       ...
                       </h:panelGroup>
                       </a4j:outputPanel>
                      ...
                      


                      • 8. Re: integration with Trinidad (ADF)

                        okay.
                        After doing some more research on that topic, I solved this problem myself.
                        All you have to do is to include the aj4-trinidad.jar, provided at the ajax4jsf website and everything works smoothly.

                        Although I used the 1.0.6 you still need the 1.0.5-a4j-trinidad. This was a bit confusing as I thought it might already be included in the newer version.

                        Maybe someone might get into the same problem - so this might help.

                        Thomas