myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@elfwyn.net
Subject Re: [TRINIDAD] Problem moving from standard MyFaces to Trinidad
Date Fri, 27 Feb 2009 10:49:04 GMT
Adding these Servlet mappings did not solve my problem.

Here is a description of the faulty application

faces-config.xml:

    <application>
        <default-render-kit-id>org.apache.myfaces.trinidad.core</default-render-kit-id>
        <!--view-handler>com.sun.facelets.FaceletViewHandler</view-handler-->
    </application>

MyFaces Core xhtml File:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Anfrage</title>
</head>
<body>
<f:view>
<h:messages></h:messages>
<h:form id="nameform">
Vorname <h:inputText id="vorname" required="true" value="#{anfragePerson.vorname}"/><br/>
Nachname <h:inputText id="nachname" required="true" value="#{anfragePerson.nachname}"/><br/>
<h:commandButton id="cbutton" value="Change"><f:actionListener type="myapp.listener.ChangeActionListener"/></h:commandButton>
</h:form>
</f:view>
</body>
</html>

The same beaviour can be seen when using a Trinidad based page:

<tr:document
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:tr="http://myfaces.apache.org/trinidad"
   title="Facelets">
  <tr:form>
      <tr:inputText label="Vorname" id="vorname" value="#{anfragePerson.vorname}"
/>
      <tr:inputText label="Nachname" id="nachname" value="#{anfragePerson.nachname}"
/>
      <tr:commandButton id="changeButton" text="Change">
      <f:actionListener type="de.bund.bka.dad.bsp.listener.ChangeActionListener"/>
      </tr:commandButton>
   </tr:form>
</tr:document>



Listener Action:

public class ChangeActionListener implements ActionListener {
    public void processAction(ActionEvent arg0) throws AbortProcessingException {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        Application application = facesContext.getApplication();
        ValueBinding valueBinding = application.createValueBinding("#{anfragePerson}");
        AnfragePerson anfragePerson = (AnfragePerson)    valueBinding.getValue(facesContext);
        String vorname = anfragePerson.getVorname();
        anfragePerson.setVorname(anfragePerson.getNachname());
        anfragePerson.setNachname(vorname);
    }
}

web.xml:

<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<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>PT3</display-name>

    <!-- JAVAX.FACES Parameter -->
    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>

    <!-- FACELETS Parameter -->
    <context-param>
        <param-name>facelets.VIEW_MAPPINGS</param-name>
        <param-value>*.xhtml</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>

    <!-- TRINIDAD Parameter -->
    <context-param>
 <param-name>org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION</param-name>
        <param-value>true</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.CACHE_VIEW_ROOT</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>
    <context-param>
 <param-name>org.apache.myfaces.trinidad.ENABLE_LIGHTWEIGHT_DIALOGS</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
 <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_MEMORY</param-name>
        <param-value>512000</param-value>
    </context-param>
    <context-param>
 <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_DISK_SPACE</param-name>
        <param-value>5120000</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.trinidad.UPLOAD_TEMP_DIR</param-name>
        <param-value>/tmp</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.trinidad.resource.DEBUG</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
 <param-name>org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS</param-name>
        <param-value>3</param-value>
    </context-param>
    <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.DIALOG_NAVIGATION_PREFIX</param-name>
        <param-value>userInputHere:</param-value>
    </context-param>
    <context-param>
 <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
        <param-value>com.sun.facelets.FaceletViewHandler</param-value>
    </context-param>
    <!-- FILTERS -->
    <filter>
        <filter-name>trinidad</filter-name>
        <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>trinidad</filter-name>
        <servlet-name>FacesServlet</servlet-name>
    </filter-mapping>
    <!-- LISTENERS -->
    <listener>
   <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
    </listener>
    <listener>
        <listener-class>myapp.listener.ContextListener</listener-class>
    </listener>
    <!-- FACES SERVLET -->
    <servlet>
        <servlet-name>FacesServlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>FacesServlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>FacesServlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <!-- RESOURCE SERVLET -->
    <servlet>
        <servlet-name>ResourcesServlet</servlet-name>
        <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>ResourcesServlet</servlet-name>
        <url-pattern>/adf/*</url-pattern>
    </servlet-mapping>
    <!-- MISC -->
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

I have been working on this problem for several days now and
can't seem to find a sollution for it by myself.

Please help.

Yours

S.Fassel


 
I'm not sure, but I think I have read about problems using that servlet mapping.  I am using
trinidad and facelets, and I have the following servlet mappings:
<servlet-mapping>
    <servlet-name>faces</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/adf/*</url-pattern>
</servlet-mapping>

HTH

“Many men go fishing all of their lives without knowing it is not fish they are after.”
- Henry David Thoreau



On Thu, Feb 26, 2009 at 11:03 AM, Steve Horne <stevehorne@gmail.com> wrote:
Oh, sorry, I missed seeing that you already had that specified.  Everything seems OK to me.


“Many men go fishing all of their lives without knowing it is not fish they are after.”
- Henry David Thoreau






On Thu, Feb 26, 2009 at 10:52 AM, Steve Horne <stevehorne@gmail.com> wrote:
Add this context param:

<context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
</context-param>

HTH


“Many men go fishing all of their lives without knowing it is not fish they are after.”
- Henry David Thoreau






On Thu, Feb 26, 2009 at 10:15 AM, Stefan Fassel <dev@elfwyn.net> wrote:
Here my current web.xml:

<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<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>myApp</display-name>
   <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
   </context-param>
   <context-param>
       <param-name>facelets.VIEW_MAPPINGS</param-name>
       <param-value>*.xhtml</param-value>
   </context-param>

<!-- ************************ Trinidad Config **************************** -->
   <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
   </context-param>
   <context-param>
       <param-name>facelets.SKIP_COMMENTS</param-name>
       <param-value>true</param-value>
   </context-param>

   <context-param>
       <param-name>org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION</param-name>
       <param-value>true</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.CACHE_VIEW_ROOT</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>
   <context-param>
       <param-name>org.apache.myfaces.trinidad.ENABLE_LIGHTWEIGHT_DIALOGS</param-name>
       <param-value>true</param-value>
   </context-param>
   <context-param>
       <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_MEMORY</param-name>
       <param-value>512000</param-value>
   </context-param>
   <context-param>
       <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_DISK_SPACE</param-name>
       <param-value>5120000</param-value>
   </context-param>
   <context-param>
       <param-name>org.apache.myfaces.trinidad.UPLOAD_TEMP_DIR</param-name>
       <param-value>/tmp</param-value>
   </context-param>
   <context-param>
       <param-name>org.apache.myfaces.trinidad.resource.DEBUG</param-name>
       <param-value>true</param-value>
   </context-param>
   <context-param>
       <param-name>org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS</param-name>
       <param-value>3</param-value>
   </context-param>
   <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.DIALOG_NAVIGATION_PREFIX</param-name>
       <param-value>userInputHere:</param-value>
   </context-param>
   <context-param>
       <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
       <param-value>com.sun.facelets.FaceletViewHandler</param-value>
   </context-param>
   <filter>
       <filter-name>trinidad</filter-name>
       <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
   </filter>
   <filter-mapping>
       <filter-name>trinidad</filter-name>
       <servlet-name>FacesServlet</servlet-name>
   </filter-mapping>
<!-- ********************* Trinidad Config  Ende ************************* -->

   <listener>
       <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
   </listener>
   <listener>
       <listener-class>my.project.listener.ContextListener</listener-class>
   </listener>
   <servlet>
       <servlet-name>FacesServlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet>
       <servlet-name>resources</servlet-name>
       <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
   </servlet>
   <servlet-mapping>
       <servlet-name>FacesServlet</servlet-name>
       <url-pattern>*.jsf</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
       <servlet-name>resources</servlet-name>
       <url-pattern>/adf/*</url-pattern>
   </servlet-mapping>
   <session-config>
       <session-timeout>30</session-timeout>
   </session-config>

   <welcome-file-list>
       <welcome-file>index.jsp</welcome-file>
   </welcome-file-list>
</web-app>

Yours

S.Fassel


Steve Horne wrote:

Please post your web.xml.

“Many men go fishing all of their lives without knowing it is not fish they are after.”
- Henry David Thoreau





On Thu, Feb 26, 2009 at 3:51 AM, Stefan Fassel <dev@elfwyn.net <mailto:dev@elfwyn.net>>
wrote:

    Hello again

    I have decided to rephrace my Question from before

    I have a running Application using:

    JSF 1.1
    Tomcat 5.5.23
    Java 1.5
    Facelets 1.1.14

    Now I want to introduce the Trinidad 1.0.10 component framework.

    There was a partial success since I got Trinidad to render the
    first xhtml-file.

    The problem here is, that when submitting the first page the same
    page is reredered again and both
    the Action Implements and Managed beans are never used.

    This also happens when using an xhtml-file without Trinidad-Tags.

    By removing Trinidad - replacing
    <default-render-kit-id>org.apache.myfaces.trinidad.core</default-render-kit-id>
    by
    <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
    in faces-config.xml - the Actions and Managed Beans are again
    working as they were meant to.

    This effect can be seen with and without using navigation-rules.

    Maybe someone knows this error pattern...

    Yours

    S. Fassel
Mime
View raw message