Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 10 of 10

Thread: JSF directory structur

  1. #1
    Member
    Join Date
    Sep 2011
    Posts
    63
    My Mood
    Confused
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default JSF directory structur

    Can somebody tell me if there is a requirement for JSF pages to be in a directory called "pages"? I have created an application and when all the pages are either in the root or in a file called "pages" everything works fine. However when I try to move the pages into a directory called "test" the pages are no longer recognised. I get a Error 500 for all the pages in the "test" directory!!!

    Just to be clear, the file directory was:

    Web Pages > pages > dashboard.xhtml

    and this was accessible at URL:

    http://localhost:8080/Application/pages/dashboard.xhtml

    I then changed the file directory to:

    Web Pages > test > dashboard.xhtml

    and I get an error 500 at URL:

    http://localhost:8080/Application/test/dashboard.xhtml



  2. #2
    Member
    Join Date
    Sep 2011
    Posts
    63
    My Mood
    Confused
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Re: JSF directory structur

    BTW this is my web.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
        <display-name>Web2Framework</display-name>
        <!-- CONTEXT PARAMETERS -->
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                /WEB-INF/spring/app-context.xml
            </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>log4jConfigLocation</param-name>
            <param-value>/WEB-INF/log4j.xml</param-value>
        </context-param>
        <!-- LISTENER DECLARATION -->
        <listener>
            <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
        </listener>
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <!-- FILTER DECLARATION -->
        <context-param>
            <param-name>javax.faces.PROJECT_STAGE</param-name>
            <param-value>Production</param-value>
        </context-param>
        <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>springSecurityFilterChain</filter-name>
            <url-pattern>/*</url-pattern>
            <dispatcher>FORWARD</dispatcher>
            <dispatcher>REQUEST</dispatcher>
        </filter-mapping>
        <!-- SERVLET DECLARATION -->
        <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>
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>*.xhtml</url-pattern>
        </servlet-mapping>
        <!-- WELCOME PAGES -->
        <welcome-file-list>
            <welcome-file>/welcome.xhtml</welcome-file>
        </welcome-file-list>
    </web-app>

  3. #3
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: JSF directory structur

    Have you got a faces-config file?
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  4. #4
    Member
    Join Date
    Sep 2011
    Posts
    63
    My Mood
    Confused
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Re: JSF directory structur

    Yes sorry...

    <?xml version="1.0" encoding="UTF-8"?>
    <faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
                  xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
     
            <!-- NAVIGATION RULES -->
        <navigation-rule>
            <from-view-id>/welcome.xhtml</from-view-id>
            <navigation-case>
                <from-outcome>admin</from-outcome>
                <to-view-id>/test/dashboard.xhtml</to-view-id>
                <redirect />
            </navigation-case>
            <navigation-case>
                <from-outcome>admintest</from-outcome>
                <to-view-id>/pages/dashboard.xhtml</to-view-id>
                <redirect />
            </navigation-case>
        </navigation-rule>
     
        <navigation-rule>
            <display-name>accessDenied.xhtml</display-name>
            <from-view-id>/accessDenied.xhtml</from-view-id>
            <navigation-case>
                <from-outcome>welcome</from-outcome>
                <to-view-id>/welcome.xhtml</to-view-id>
            </navigation-case>
        </navigation-rule>
     
     
        <navigation-rule>
            <display-name>test/dashboard.xhtml</display-name>
            <from-view-id>/test/dashboard.xhtml</from-view-id>
            <navigation-case>
                <from-outcome>welcome</from-outcome>
                <to-view-id>/welcome.xhtml</to-view-id>
            </navigation-case>
        </navigation-rule>
     
     
        <!-- Localization -->
        <application>
            <locale-config>
                <default-locale>en</default-locale>
            </locale-config>
     
            <resource-bundle>
                <base-name>tv.tarka.locale.messages.Messages</base-name> 
                <var>message</var>
            </resource-bundle>
          <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
        </application>
     
    </faces-config>

  5. #5
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: JSF directory structur

     <from-outcome>admintest</from-outcome>
                <to-view-id>/pages/dashboard.xhtml</to-view-id>
                <redirect />

    Try replacing that 'pages' to test
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  6. #6
    Member
    Join Date
    Sep 2011
    Posts
    63
    My Mood
    Confused
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Re: JSF directory structur

    This is my problem:

    This works:
            <navigation-case>
                <from-outcome>admintest</from-outcome>
                <to-view-id>/pages/dashboard.xhtml</to-view-id>
                <redirect />
            </navigation-case>

    This doesn't:
           <navigation-case>
                <from-outcome>admin</from-outcome>
                <to-view-id>/test/dashboard.xhtml</to-view-id>
                <redirect />
            </navigation-case>

  7. #7
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: JSF directory structur

    Lets see the piece of code which returns the outcome "admin" and "admintest"?
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  8. #8
    Member
    Join Date
    Sep 2011
    Posts
    63
    My Mood
    Confused
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Re: JSF directory structur

    Brace yourself, its pretty hard core...

    <h:commandButton value="admintest" action="admintest" />
    <h:commandButton value="admin" action="admin" />

    I have been experimenting with other directory names (admin, user etc.) and it really does only seem to want to work with a directory called "pages"!!! I seem to be able to have unlimited* directories under the "pages" and still work.

    (*I've tested 3!)

  9. #9
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: JSF directory structur

    Does the Error 500 occur on the welcome page? or after you've clicked on of those command buttons?
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  10. #10
    Member
    Join Date
    Sep 2011
    Posts
    63
    My Mood
    Confused
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Re: JSF directory structur

    After 3 hours I have finally found the answer... If you have ever read "the hitchhiker's guide to the galaxy" you'll know what I mean when I say that the answer is on par with "THE ANSWER". In Netbeans you can't move files by dragging them to a new directory, you have to recreate them from scratch. If you drag them the IDE just doesn't acknowledge that they exist!


Similar Threads

  1. How to copy files from one directory to another directory
    By kewlkeny in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: January 25th, 2012, 07:36 AM
  2. [SOLVED] No META-INF directory
    By skiabox in forum JavaServer Pages: JSP & JSTL
    Replies: 2
    Last Post: July 1st, 2011, 03:28 PM
  3. About META-INF directory?
    By chinni in forum Java Servlet
    Replies: 2
    Last Post: February 9th, 2010, 10:36 AM
  4. where can i find the tmp/foo directory?
    By Idy in forum Java IDEs
    Replies: 11
    Last Post: January 19th, 2010, 11:21 AM
  5. Class directory
    By Kit in forum Java Theory & Questions
    Replies: 7
    Last Post: October 11th, 2009, 10:07 AM