4 Replies Latest reply on Jul 12, 2007 9:40 AM by John Brosan

    Subdirectories in the view folder

    John Brosan Newbie

      I would like to keep my xhtml files organized and so I thought that setting up subdirectories in the /view folder would be a good idea. However, after adding the directory and adding a simple page I get a 404 when attempting to access the page.

      HTTP Status 404 - /testapp/admin/userlist.seam
      
      type Status report
      
      message /testapp/admin/userlist.seam
      
      description The requested resource (/testapp/admin/userlist.seam) is not available.
      JBossWeb/2.0.0.GA
      



      I am using to access the page.

       <s:link view="/admin/userlist.xhtml" value="User List" action="#{useraction.getUserlist}" />
      


      I am using Linux and have checked the permissions on the file and they appear to be correct. I also checked the exploded war file and the directory and the file do exist. I am sure I missed something pretty trivial here.

      Any help would be most appreciated.

      Thanks,
      John


        • 1. Re: Subdirectories in the view folder
          steve tynor Novice

          If you look at your jboss console output, you'll probably see that the page is unable to render since it can't follow one of its template links.

          Check any template links on the page -- seam-gen generates relative links that look like this:

           template="layout/template.xhtml">
          ...
           <s:decorate template="layout/display.xhtml">
          


          If you move the page to a directory other than the root, you need to change those references to not be relative:

           template="/layout/template.xhtml">
          ...
           <s:decorate template="/layout/display.xhtml">
          

          (Seam developers: is there any reason why seam-gen should not generate with that leading slash? Such a reference works both in the oringinal location and tolerates page movement).



          • 2. Re: Subdirectories in the view folder
            Norman Richards Master

            There's no technical reason that I know of to prefer one to the other. As a matter of style, I prefer an absolute path for those things. In fact, I my preference is to put the templates off somewhere in /WEB-INF to really make things nice and clean.

            <ui:composition template="/WEB-INF/template.xhtml">


            or

            <ui:include src="/WEB-INF/incl/cart.xhtml" />


            Unfortunately, this practice doesn't seem to have caught on, so people keep running into relative path problems and run the risk of unexpected things happening if someone tries to access the template instead of the real page.



            • 3. Re: Subdirectories in the view folder
              John Brosan Newbie

              Thanks, I'll check out all of the template references. :)

              • 4. Re: Subdirectories in the view folder
                John Brosan Newbie

                Tynor,

                The relative link to the template turned out to be the issue.

                Thanks for the help, I really appreciate it.

                -John