Hello!

Well, I have struggled with my web.xml for quite some time now and I just can't 
get this to work with myFaces. 

First things first:
I'm using SUN Java Studio 8.0 Enterprise and the application server that comes 
with de program on localhost. The application I'm building workes fine if I'm 
not using MyFaces modification in web.xml but now I want to use the calendar 
component in myFaces.

My web.xml looked like this when it didn't contain any myFaces filters.
-------- 8< --------
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 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";>
    <servlet>
        <servlet-name>FacesServlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>FacesServlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>survey.jsf</welcome-file>
    </welcome-file-list>
</web-app>
--------------------

I could browse my aplication by pointing the browser to: 
http://localhost:6060/testapl/index.jsf

Now, I have done the modification to web.xml according to apache/myfaces 
homepage so now it looks like this:

------ 8< -----------
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 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";>
<filter>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
    <init-param>
        <description>Set the size limit for uploaded files.
            Format: 10 - 10 bytes
                    10k - 10 KB
                    10m - 10 MB
                    1g - 1 GB
        </description>
        <param-name>maxFileSize</param-name>
        <param-value>20m</param-value>
        
    </init-param>
</filter>

<!-- extension mapping for adding <script/>, <link/>, and other resource tags 
to JSF-pages  -->
<filter-mapping>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <!-- servlet-name must match the name of your 
javax.faces.webapp.FacesServlet entry -->
    <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

<!-- extension mapping for serving page-independent resources (javascript, 
stylesheets, images, etc.)  -->
<filter-mapping>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>
        
    <servlet>
        <servlet-name>FacesServlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>FacesServlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>test.jsf</welcome-file>
    </welcome-file-list>
</web-app>
------------------------

And now I get an 404 page missing error when i point my browser to:
http://localhost:6060/testapl/index.jsf

I have also tried:
http://localhost:6060/testapl/index.jsp
http://localhost:6060/testapl/index.faces
http://localhost:6060/testapl/faces/index.jsf
http://localhost:6060/testapl/faces/index.jsp

With no luck. 
Feels like I'm missing something important. But what?

Thanks
Fredrik

________________________________

Från: Chandra Sekhar [mailto:[EMAIL PROTECTED] 
Skickat: den 5 augusti 2006 08:10
Till: MyFaces Discussion
Ämne: Re: SUNs studio enterprise 8 and web.xml config problem


Hi,
 
Create a mapping for your servlet and try accessing in this way.
 Can you try once accessing your form as 
project/faces/test.jsf.
 
I'm attaching my web.xml havea reference to it and the problem can  be solved.
 
 
<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="2.4" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>

<!--Configuring facesConfig.xml -->

<context-param>

<param-name>javax.faces.CONFIG_FILES</param-name>

<param-value>/WEB-INF/faces-config.xml</param-value>

</context-param>

<!-- State Saving Method for Client and Server -->

<context-param>

<param-name>javax.faces.STATE_SAVING_METHOD</param-name>

<param-value>client</param-value>

</context-param>

<!-- This is the Tag which allows JavaScript into your JSF Application .Default 
is true -->

<context-param>

<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>

<param-value>true</param-value>

</context-param>

<!-- This is the tag for AutoScroll of your JSF page default is true -->

<context-param>

<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>

<param-value>true</param-value>

</context-param>

<!-- Tag for Checking your HTML along with your rendererd JSF Components as 
HTML -->

<context-param>

<param-name>org.apache.myfaces.PRETTY_HTML</param-name>

<param-value>true</param-value>

</context-param>

<!-- Tag for the Faces Context Listener -->

<listener>

<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>

</listener>

<!-- Initialization of the Faces Servlet -->

<servlet>

<servlet-name>FacesServlet</servlet-name>

<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

<load-on-startup>0</load-on-startup>

</servlet>

<!-- Faces Servlet PATH mapping with the referred URL Pattern -->

<servlet-mapping>

<servlet-name>FacesServlet</servlet-name>

<url-pattern>/faces/*</url-pattern>

</servlet-mapping>

<!-- Faces Servlet EXTENSION mapping with the referred URL Pattern -->

<servlet-mapping>

<servlet-name>FacesServlet</servlet-name>

<url-pattern>*.jsf</url-pattern>

</servlet-mapping>

</web-app>

 

 
 
 
Chandru.

        ----- Original Message ----- 
        From: nimisha sharma <mailto:[EMAIL PROTECTED]>  
        To: MyFaces Discussion <mailto:users@myfaces.apache.org>  
        Sent: Saturday, August 05, 2006 6:02 AM
        Subject: Re: SUNs studio enterprise 8 and web.xml config problem

        this link works absoluely fine.. we had faced same issues n this is 
where it got solved.. :-)
        
        
        On 8/4/06, Mike Kienenberger <[EMAIL PROTECTED]> wrote: 

                There may be something that can help you here.
                If not, please update it when you do solve your issues.
                
                http://wiki.apache.org/myfaces/Installation_and_Configuration
                
                
                On 8/4/06, Sköldheimer Fredrik < [EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]> > wrote:
                >
                >
                > Hello all!
                >
                > This is my first post so please be gentle ;-)
                > I´m keen on trying the MyFaces taglib in my application but 
I´m having
                > problems getting it to work properly. I´m using SUNs Java 
studio enterprise 
                > 8 and deploy to localhost running SUNs web/app server that 
comes with
                > enterprise.
                > OK then, Here is what I have done so far.
                >
                > First attempt:
                > =======================
                > I just included the 
                >
                > <% @taglib uri="http://myfaces.apache.org/tomahawk";
                > prefix="t"%>
                >
                > on my jsp page and tried to add a component like this: 
                > <t:inputCalendar popupDateFormat="yyyy-MM-dd" 
popupWeekString="v"
                > popupTodayString="Idag är" renderPopupButtonAsImage="true"
                > addResources="true" styleClass="inputfieldsText" 
style="width:73" 
                > id="eventdate" renderAsPopup="true" tabindex="1" 
maxlength="10"
                > forceId="true">
                > </t:inputCalendar>
                >
                > Well, It worked, kind of. I´m getting a Javascript error on 
the page so I 
                > googled it and found out that I had to do some editing in my 
web.xml file
                > that, at first looked like this:
                >
                > ------------- 8< -------
                > <?xml version="1.0" encoding="UTF-8"?> 
                > <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee";
                > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
<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 
<http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd> ">
                >     <servlet>
                >         <servlet-name>FacesServlet</servlet-name>
                >         
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                >         <load-on-startup>1</load-on-startup> 
                >     </servlet>
                >     <servlet-mapping>
                >         <servlet-name>FacesServlet</servlet-name>
                >         <url-pattern>*.jsf</url-pattern>
                >     </servlet-mapping> 
                >     <session-config>
                >         <session-timeout>30</session-timeout>
                >     </session-config>
                >     <welcome-file-list>
                >         <welcome-file>survey.jsf </welcome-file>
                >     </welcome-file-list>
                > </web-app>
                > -----------------------------
                >
                >
                > Second atempt:
                > =================
                > So I modified the web.xml to look like this:
                >
                > ----------- 8< --------
                > <?xml version="1.0" encoding="UTF-8"?>
                > <web-app version="2.4" xmlns=" 
http://java.sun.com/xml/ns/j2ee <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> 
                > http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
                >     <filter>
                >  <filter-name>MyFacesExtensionsFilter</filter-name> 
                > 
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
                >     <init-param>
                >         <param-name>maxFileSize</param-name>
                >         <param-value>20m</param-value> 
                >     </init-param>
                > </filter>
                >
                > <!-- extension mapping for adding <script/>, <link/>, and 
other resource
                > tags to JSF-pages  -->
                > <filter-mapping> 
                >     <filter-name>MyFacesExtensionsFilter</filter-name>
                >     <!-- servlet-name must match the name of your
                > javax.faces.webapp.FacesServlet entry -->
                >     <servlet-name>FacesServlet</servlet-name> 
                > </filter-mapping>
                >
                > <!-- extension mapping for serving page-independent resources 
(javascript,
                > stylesheets, images, etc.)  -->
                > <filter-mapping>
                >     <filter-name>MyFacesExtensionsFilter</filter-name> 
                >
                > <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
                > </filter-mapping>
                >
                >
                >     <servlet>
                >         <servlet-name>FacesServlet</servlet-name> 
                >         
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                >         <load-on-startup>1</load-on-startup>
                >     </servlet>
                >     <servlet-mapping> 
                >         <servlet-name>FacesServlet</servlet-name>
                >         <url-pattern>*.jsf</url-pattern>
                >     </servlet-mapping>
                >     <session-config>
                >         <session-timeout>30</session-timeout> 
                >     </session-config>
                > </web-app>
                > ----------------------------------
                >
                >
                > But ups, Now I can't access my pages anymore. I get an 404 
error from the
                > webserver /app server like this: 
                > ------------- 8< --------------
                >
                >
                > type Status report
                >
                > message /project/test.jsf
                >
                > description The requested resource (/project/test.jsf) is not 
available.
                > ------------- 8< --------------
                >
                > And the same problem if I try to change .jsf to .jsp or 
anything else for
                > that matter. So, something seems to be wrong with the filter 
thing in
                > web.xml but I can't figure out what.
                >
                > Thank you
                > Fredrik
                >
                >
                >
                



Reply via email to