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" 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>
-----------------------------
 
 
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" 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>
        <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