facebook

MyFaces 1.0.8

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #225121 Reply

    John Parker
    Member

    If anyone has a clear method of setting up a MyFaces-blank type of application I would really appreciate it. I have tried hacking out the parts of myfaces-examples I don’t want but its really trial and error and I am currently looking at a blank page, no idea why. This app used to work (sort of).

    I have just upgraded everything so I am running Tomcat 5.5.7, MyEclipse 3.8.4, JDK 5.0.1.

    The ideal solution would be to describe how to change the Add Javaserver Faces Capabilities feature of MyEclipse to use the 1.0.8 MyFaces libs.

    Do I simply remove jsf-api.jar and jsf-impl.jar, and substitute myfaces-jsf-api.jar, and myfaces.jar?

    Do I need any tld’s? I don’t see them in the myfaces-examples.

    What about the web.xml? Will I still need to modify it to use MyFaces libs?

    Thanks in advance…

    #225132 Reply

    Riyad Kalla
    Member

    how to change the Add Javaserver Faces Capabilities feature of MyEclipse to use the 1.0.8 MyFaces libs.

    Window > Preferences > MyEclipse > Project Capabilities > JavaServer Faces, remove what is there and add whatever you like.

    Do I simply remove jsf-api.jar and jsf-impl.jar, and substitute myfaces-jsf-api.jar, and myfaces.jar?

    The MyFaces site install section has a list of exactly the JARs you need for MyFaces.

    Do I need any tld’s? I don’t see them in the myfaces-examples.

    They are in the JAR files under the META-INF dir, this is a valid location according to web spec. Struts does this too.

    What about the web.xml? Will I still need to modify it to use MyFaces libs?

    Just as you would modify this to use Struts, Sun’s JSF, Tapestry or any other servlet technology, you will also need to modify it to point to the MyFaces servlet to intercept *.faces or /faces (or whatever you want) URL requests. With MyFaces there are also many other init-params you can setup, please see the MyFaces docs (or their sample web.xml files).

    #225188 Reply

    John Parker
    Member

    Quote:

    Do I need any tld’s? I don’t see them in the myfaces-examples.

    They are in the JAR files under the META-INF dir, this is a valid location according to web spec. Struts does this too.

    I don’t see any files, .tld or .jar, under META-INF for the MyFaces examples. Could you please explain more fully?

    Thanks very much for your help.

    #225190 Reply

    Riyad Kalla
    Member

    I have 1.0.7 installed here, and it is in the META-INF dir in the myfaces.jar file.

    #225197 Reply

    John Parker
    Member

    I see the tlds inside the jar file.

    So, should I add myfaces.jar to the list of tlds in Add Javaserver Faces Capabilities? It seems to want a tld file, not a jar. Or should I extract the tlds? I don’t see them in the myfaces-examples.war file.

    Sorry if these are dumb questions, but I can’t find this information anywhere on the MyFaces site.

    Thanks again.

    #225205 Reply

    Riyad Kalla
    Member

    So, should I add myfaces.jar to the list of tlds in Add Javaserver Faces Capabilities? It seems to want a tld file, not a jar. Or should I extract the tlds? I don’t see them in the myfaces-examples.war file.

    Nope, just empty out the TLD list, that is what I do for the JSF and Struts capabilities, because both include the TLDs in their JAR files under the META-INF, which according to the web spec are perfectly valid places for them to be in order to be resolved by the application server.

    #225268 Reply

    John Parker
    Member

    OK, I am very confused now, however I think I see what some problems are…

    Problem 1. MyFaces specifies Webapp 2.3 spec in web.xml in myfaces-examples application, and your script sets up 2.4 in web.xml – which should I use?

    Problem 2. MyFaces website says to include the following in a web app: myfaces-jsf-api.jar, myfaces.jar, jstl.jar, jakarta-oro.jar, commons-codec-1.2.jar, commons-el.jar, commons-fileupload-1.0.jar, commons-logging.jar and commons-validator.jar, yet in their myfaces-examples (working for me) sample app, I also see jsp-2.0.jar, commons-beanutils.jar, commons-collections.jar, commons-digester.jar. Are these necessary? How do I determine their function?

    Problem 3. I tried to include a section of the web.xml from myfaces-example, namely:

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

    but I get a catalina exception, saying that
    java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name extensionsFilter

    I followed the JSFLoginDemo to the letter, except that there is no web.xml provided with it. All I get is a 404 error, no matter what URL I try. I also have tried a redirect page, using *.jsf as a servlet-mapping url pattern. What am I doing wrong?

    #225272 Reply

    Riyad Kalla
    Member

    and your script sets up 2.4 in web.xml

    If you select Web spec 2.4 during the new project wizard, then yes it will, you can also specify 2.3 when creating a new project.

    which should I use?

    It shouldn’t matter. Just make sure to include the correct servlet/servlet-mapping entries for the faces servlet.

    I also see jsp-2.0.jar, commons-beanutils.jar, commons-collections.jar, commons-digester.jar. Are these necessary?

    It depends, some app servers (like Tomcat) provide these for all the webapps out of the box. Just follow the MyFaces docs.

    but I get a catalina exception, saying that
    java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name extensionsFilter

    Well if you didn’t define what the filter actually is before using this mapping, then Tomcat has no idea what “extensionsFilter” is.

    What am I doing wrong?

    I have no idea without looking at your project and unfortunately am swamped with work right now so I don’t have the time to take a look. I would strongly suggest creating a new Web Project, then adding JSF capabilities to it, then working from there, try and create 1 JSP file, make sure it works, then add a managed bean, see if that works, etc… don’t dive in head-first into a new technology, because if something goes wrong you aren’t used to the framework or the errors yet to track down what the problem is. Once you get used to JSF’s behaviors this should become second nature to you.

    #225278 Reply

    John Parker
    Member

    OK, sorry I appreciate the fact that you’re busy, but I did have most of a medium size JSF project working before I tried upgrading from Myfaces 1.0.7 to 1.0.8 – I created that project by hacking up the myfaces-examples.

    Last question: I followed the JSFLoginDemo tutorial to the letter, except for using MyFaces jars as you described, and then copied the myfaces-examples app web.xml over. Now I get:

    INFO: Installing web application at context path /JSFloginDemo from URL file:D:\Java\Tomcat5028\webapps\JSFLoginDemo
    16-Feb-2005 11:14:12 AM org.apache.catalina.core.StandardContext start
    SEVERE: Error listenerStart
    16-Feb-2005 11:14:12 AM org.apache.catalina.core.StandardContext start
    SEVERE: Context startup failed due to previous errors

    #225280 Reply

    Riyad Kalla
    Member

    Check your other log files for more details of the error, I think you have an invalid listener setup in your web.xml file, I know MyFaces, IIRC, uses a listener for initialization, make sure that in 1.0.8 it wasn’t renamed or something, check the docs to see if it is still the same.

    #225283 Reply

    John Parker
    Member

    As I said I copies the web.xml from a working 1.0.8 myfaces-examples:

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

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: MyFaces 1.0.8

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