facebook

Setup MyFaces examples

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #252793 Reply

    ldr
    Member

    Hi, Im trying to get the example projects working in myeclipse but with no luck.

    first of all im unsure which implementation to use when adding jsf capabilities:
    – Sun JSF Reference Implementation 1.1.01
    – MyFaces 1.0.9
    – MyFaces 1.1.1

    moreover should I install jsp-2.0.jar ?

    Then I have changed the following import:
    //import net.sourceforge.myfaces.custom.fileupload.UploadedFile;
    To -> import org.apache.myfaces.custom.fileupload.UploadedFile;

    and
    //import net.sourceforge.myfaces.custom.navmenu.NavigationMenuItem;
    To -> import org.apache.myfaces.custom.navmenu.NavigationMenuItem;

    Here is my web.xml:
    ************************************************************
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <web-app xmlns=”http://java.sun.com/xml/ns/j2ee&#8221; xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; version=”2.4″ xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”&gt;
    <context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config.xml</param-value>
    </context-param>
    <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>0</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <filter>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
    <init-param>
    <param-name>maxFileSize</param-name>
    <param-value>20m</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <url-pattern>*.jsf</url-pattern>
    </filter-mapping>
    </web-app>
    ************************************************************************

    When I use MyFaces 1.1.1 without jsp2.0 I get the following error:
    ************************************************************************
    exception

    javax.servlet.ServletException: The absolute uri: http://myfaces.sourceforge.net/tld/myfaces_ext_0_9.tld cannot be resolved in either web.xml or the jar files deployed with this application
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
    org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

    root cause

    javax.faces.FacesException: The absolute uri: http://myfaces.sourceforge.net/tld/myfaces_ext_0_9.tld cannot be resolved in either web.xml or the jar files deployed with this application
    org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
    org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
    org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
    org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

    Thanks in advance

    Chris

    #252818 Reply

    Riyad Kalla
    Member

    Chris,
    If you plan to use the MyFaces taglibs, then you need to use the MyFaces implementation, in which case I would suggest the most recent 1.x release in that drop down. And no you shouldn’t add jsp-2.0.jar unless you are deploying to an older app server, that is what the popup explains when it asks you if you want it or not.

    #252849 Reply

    ldr
    Member

    Found the root of the problem, here it goes…

    Problem: Resolving absolute uri for tld (ex. myfaces -> http://myfaces.sourceforge.net/tld/myfaces_ext_0_9.tld)
    Solution: Find the JAR that provides your myfaces extensions tags, and open it up, go into the META-INF dir and open one of the TLD files, look around the 5th line or so for a tag: <url>link</url> or <uri>link</uri> use whatever the link part is to update your web.xml entries OR if you are using the default URI, update your <%@taglib%> entries in your JSP files. In my case -> http://myfaces.apache.org/extensions

    Now its running but still with errors, especially bc. I have mixed libs -> that is org.apache.myfaces…. and net.sourceforge.myfaces… very clumsy

    Also earlier I had problems with JBoss 4 using the following taglibs for jsf:

    <%@ taglib uri=”http://java.sun.com/jsf/html&#8221; prefix=”h”%>
    <%@ taglib uri=”http://java.sun.com/jsf/core&#8221; prefix=”f”%>

    and had to change it to the following to get it working:

    <%@ taglib uri=”/WEB-INF/html_basic.tld” prefix=”h” %>
    <%@ taglib uri=”/WEB-INF/jsf_core.tld” prefix=”f” %>

    Havent done this yet for the myfaces-examples…

    Hope this helps others

    Chris

    #252850 Reply

    ldr
    Member

    BTW thx Riyad 4 info

    #252864 Reply

    Riyad Kalla
    Member

    Thank you for following up for others.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Setup MyFaces examples

You must be logged in to post in the forum log in