Marco-

It sounds to me like your webapp is not properly deployed in your webserver.


Can you get a page directly /TestJSFApp/index.html without going through the FacesServlet?

Also, you said the code you included was index.html, but your url says it is for main.jsf.  You should be hitting index.jsf.

Finally, if that doesn't solve it, could you send the relevant sections of your web.xml?

Adam Brod

Product Development Team


"Marco Mistroni" <[EMAIL PROTECTED]>

02/21/2006 10:19 AM

Please respond to
"MyFaces Discussion" <users@myfaces.apache.org>

To
"MyFaces Discussion" <users@myfaces.apache.org>
cc
Subject
MyFAces with FAcelets





hello all,
 i have just downloaded the latest version of facelets (1.0.10) to be used with myfaces

i (literally) copied context parameters from demo application, because i wanted to try to
use facelets in my pages...

It turned out that, for some weird reasons, the page was not rendered at all......

for example, here's my index.html (copied from numberguess application)

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="refresh" content="0; url= "" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>


when this gets loaded (and it will try to load the main.jsf )

the app fails miserably by saying

The requested resource (/TestJSFApp/main.jsf) is not available.

For some weird reason, page does not get rendered, which leads me to think that
some parameters are not set, since i am having a main.xhtml (written usign facelets) that should
be rendered properly....


can anyone find any reason of why facelets does not work with my applications?

regards
 marco



here's my web.xml      (be patient, it's long)

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

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "
http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app >
<context-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>
       /WEB-INF/core-context.xml
       /WEB-INF/web-context.xml
       /WEB-INF/aop-context.xml
       /WEB-INF/applicationContext-acegi-security.xml
       /WEB-INF/applicationContext- common-authorization.xml
       /WEB-INF/applicationContext-common-business.xml
           /WEB-INF/faces-context.xml
       /WEB-INF/dataSourcePopulator.xml
       
   </param-value>
</context-param>

<context-param>
 <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
 <param-value>resources.MessageResources</param-value>
</context-param>

<context-param>
     <param-name>javax.faces.CONFIG_FILES</param-name>
     <param-value>/WEB-INF/faces-config.xml,/WEB-INF/faces-managed-beans.xml,/WEB-INF/faces-navigation.xml</param-value>
</context-param>

<context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
       <description>
           State saving method: "client" or "server" (= default)
           See JSF Specification 2.5.2
       </description>
   </context-param>

   <context-param>
       <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
       <param-value>true</param-value>
       <description>
           This parameter tells MyFaces if _javascript_ code should be allowed in the
           rendered HTML output.
           If _javascript_ is allowed, command_link anchors will have _javascript_ code
           that submits the corresponding form.
           If _javascript_ is not allowed, the state saving info and nested parameters
           will be added as url parameters.
           Default: "true"
       </description>
   </context-param>

   <context-param>
       <param-name>org.apache.myfaces.DETECT_JAVASCRIPT </param-name>
       <param-value>false</param-value>
   </context-param>

   <context-param>
       <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
       <param-value>true</param-value>
       <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>
   </context-param>

   <context-param>
       <param-name>org.apache.myfaces.AUTO_SCROLL </param-name>
       <param-value>true</param-value>
       <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>
   </context-param>

  <context-param>

       <param-name>tiles-definitions</param-name>

       <param-value>/WEB-INF/tiles-defs.xml</param-value>

       <description>
       Tiles configuration

            definition files and a listener need to be defined.
            the listener will initialize JspTilesViewHandlerImpl with tiles definitions.

       </description>
  </context-param>

      <context-param>
       <param-name>facelets.REFRESH_PERIOD</param-name>
       <param-value>2</param-value>
   </context-param>

   <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
   </context-param>

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

   <context-param>
       <param-name>com.sun.faces.validateXml</param-name>
       <param-value>true</param-value>
       <description>
           Set this flag to true if you want the JavaServer Faces
           Reference Implementation to validate the XML in your
           faces-config.xml resources against the DTD.  Default
           value is false.
       </description>
   </context-param>

   <context-param>
       <param-name>com.sun.faces.verifyObjects</param-name>
       <param-value>true</param-value>
       <description>
           Set this flag to true if you want the JavaServer Faces
           Reference Implementation to verify that all of the application
           objects you have configured (components, converters,
           renderers, and validators) can be successfully created.
           Default value is false.
       </description>
   </context-param>

 <!-- Acegi filters -->

<filter>
       <filter-name>Acegi Filter Chain Proxy</filter-name>
       <filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
       <init-param>
           <param-name>targetClass</param-name>
           <param-value> net.sf.acegisecurity.util.FilterChainProxy</param-value>
       </init-param>
</filter>

<filter>
       <filter-name>contextHolderAwareFilter</filter-name>
       <filter-class> net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
       <init-param>
           <param-name>targetClass</param-name>
           <param-value>net.sf.acegisecurity.wrapper.ContextHolderAwareRequestFilter </param-value>
       </init-param>
</filter>

<filter>
       <filter-name>anonymousProcessingFilter</filter-name>
       <filter-class>net.sf.acegisecurity.util.FilterToBeanProxy </filter-class>
       <init-param>
           <param-name>targetClass</param-name>
           <param-value>net.sf.acegisecurity.util.FilterChainProxy</param-value>
       </init-param>
</filter>

<filter>
       <filter-name>extensionsFilter</filter-name>
       <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
       <init-param>
           <param-name>uploadMaxFileSize</param-name>
           <param-value>100m</param-value>
           <description>Set the size limit for uploaded files.
               Format: 10 - 10 bytes
                       10k - 10 KB
                       10m - 10 MB
                       1g - 1 GB
           </description>
       </init-param>
       <init-param>
           <param-name>uploadThresholdSize</param-name>
           <param-value>100k</param-value>
           <description>Set the threshold size - files
                   below this limit are stored in memory, files above
                   this limit are stored on disk.

               Format: 10 - 10 bytes
                       10k - 10 KB
                       10m - 10 MB
                       1g - 1 GB
           </description>
       </init-param>
<!--        <init-param>
           <param-name>uploadRepositoryPath</param-name>
           <param-value>/temp</param-value>
           <description>Set the path where the intermediary files will be stored.
           </description>
       </init-param>-->
   </filter>

<!-- JSF-Spring filters -->

<filter>
       <filter-name>RequestHandled</filter-name>
       <filter-class>de.mindmatters.faces.spring.support.RequestHandledFilter</filter-class>
</filter>

<filter-mapping>
 <filter-name>Acegi Filter Chain Proxy</filter-name>
 <url-pattern>/*</url-pattern>
</filter-mapping>

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

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

<filter-mapping>
 <filter-name>RequestHandled</filter-name>
 <url-pattern>*.jsf</url-pattern>
</filter-mapping>

<filter-mapping>
 <filter-name>extensionsFilter</filter-name>
 <url-pattern>*.jsf</url-pattern>
</filter-mapping>
<filter-mapping>
 <filter-name>extensionsFilter</filter-name>
 <url-pattern>/faces/*</url-pattern>
</filter-mapping>

   <!--
   To use non XDoclet filter-mappings, create a filter-mappings.xml file that
   contains the additional filter-mappings and place it in your
   project's merge dir.
   -->

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

<listener>
         <listener-class> org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<listener>
     <listener-class>de.mindmatters.faces.spring.support.ContextLoaderListener</listener-class>
</listener>

<listener>
  <listener-class>net.sf.acegisecurity.ui.session.HttpSessionEventPublisher</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>

  <!--
  To specify mime mappings, create a file named mime-mappings.xml, put it in your project's mergedir.
  Organize mime-mappings.xml following this DTD slice:

  <!ELEMENT mime-mapping (extension, mime-type)>
  -->

    <welcome-file-list>
   <welcome-file>login.jsp</welcome-file>
 </welcome-file-list>

  <!--
  To specify error pages, create a file named error-pages.xml, put it in your project's mergedir.
  Organize error-pages.xml following this DTD slice:

 
    <!-- Struts-EL Tag Library Descriptors -->

 <taglib>
   <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
   <taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
 </taglib>

 <taglib>
   <taglib-uri>
http://worldcorp.co.uk/jsf/component/tags</taglib-uri>
   <taglib-location>/WEB-INF/tld/jsfapp.tld</taglib-location>
 </taglib>
<taglib>
 <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
 <taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
</taglib>

  <!--
  To set up security settings for your web app, create a file named web-security.xml, put it in your project's mergedir.
  Organize web-security.xml following this DTD slice:

  <!ELEMENT security-constraint (display-name?, web-resource-collection+, auth-constraint?, user-data-constraint?)>
  <!ELEMENT web-resource-collection (web-resource-name, description?, url-pattern*, http-method*)>
  <!ELEMENT web-resource-name (#PCDATA)>
  <!ELEMENT url-pattern (#PCDATA)>
  <!ELEMENT http-method (#PCDATA)>
  <!ELEMENT user-data-constraint (description?, transport-guarantee)>
  <!ELEMENT transport-guarantee (#PCDATA)>

  <!ELEMENT login-config (auth-method?, realm-name?, form-login-config?)>
  <!ELEMENT auth-method (#PCDATA)>
  <!ELEMENT realm-name (#PCDATA)>
  <!ELEMENT form-login-config (form-login-page, form-error-page)>
  <!ELEMENT form-login-page (#PCDATA)>
  <!ELEMENT form-error-page (#PCDATA)>
  -->

 <security-role>
     <role-name>root</role-name>
  </security-role>

</web-app>













Reply via email to