12 Replies Latest reply on Jul 7, 2010 6:34 PM by qbit42

    Subdirectory structure for Faceletes pages

    germandev.net-seam.wje-online.de

      Hi!


      I am using JBoss Tools to create my EAR project structure (and that again uses seam-gen).


      By default all .xhtml pages that are generated are in the root 'web' folder. I thought that there couldn't be a problem with moving some of the files into subdirectories, but even if the directorys are copied to EAR (actually WAR) I get a 404 error when trying to open any of them - and even the directory itself.


      Is there any way to include that directories to my project?


      Thank you in advance!

        • 1. Re: Subdirectory structure for Faceletes pages
          gonorrhea

          I have discussed this with Max Andersen (JBoss tools project lead).  The problem is the following:


          JBoss tools uses WTP (http://www.eclipse.org/webtools/) which enforces the 4 project structure for an EAR project.


          when you seam-gen a project skeleton from cmd line, you end up with one folder/project.


          Personally, I prefer the latter structure as it's simpler.


          The xhtml files in the latter structure reside here:


          foo/view


          where foo is your project name.  I have had minimal problems with my seam-gen'd project skeletons and the ant explode/deploy work well.

          • 2. Re: Subdirectory structure for Faceletes pages
            germandev.net-seam.wje-online.de

            This might be a misunderstanding.


            My current projects directory structure is


            myProject/
            myProject/web/page1a.xhtml
            myProject/web/page1b.xhtml
            myProject/web/page2a.xhtml
            myProject-ejb/
            myProject-ear/


            so all the Faceletes pages are inside one single directory (myProject/web).


            What I whant is a structure like


            myProject/
            myProject/web/sub1/page1a.xhtml
            myProject/web/sub1/page1b.xhtml
            myProject/web/sub2/page2a.xhtml
            myProject-ejb/
            myProject-ear/


            But I currently couldn't get JBoss AS to access Faceletes pages inside a sub directory of my web folder.


            Do you know how to get JBoss to acceppt subfolders to be parsed and accessed as well?


            Thanks in advance!


            Peter

            • 3. Re: Subdirectory structure for Faceletes pages
              gonorrhea

              have you tried using a src folder?

              • 4. Re: Subdirectory structure for Faceletes pages
                germandev.net-seam.wje-online.de

                Arbi Sookazian wrote on May 30, 2009 15:22:


                have you tried using a src folder?


                How do you mean that? I tried to change the subfolder to a source folder (even if the 'web' folder isn't a source folder) but that didn't change anything.


                I just don't get why these files can't be accessed - might there be a config file where I have to add the path?

                • 5. Re: Subdirectory structure for Faceletes pages
                  paulmkeogh

                  Did you get a solution for this ?


                  I have a similar problem - I can navigate to the pages contained in the sub-folder but I can't get back again !


                  • 6. Re: Subdirectory structure for Faceletes pages
                    kukeltje.ronald.jbpm.org

                    Paul Keogh wrote on Jul 28, 2009 16:43:


                    I have a similar problem - I can navigate to the pages contained in the sub-folder but I can't get back again !



                    Similar but different  ;-).... what do you mean by 'can't get back again?

                    • 7. Re: Subdirectory structure for Faceletes pages
                      paulmkeogh
                      Initially, all my .xhtml and .page.xml files were directly under the WebContent folder (I used seam-gen to generate my project). I created a sub-folder (called devices) and moved one .xhtml and matching .page.xml into the sub-folder.

                      I have a top level menu bar with several drop down menus. One of the drop down menus has a menu item that brings me the .xhtml in the devices sub-folder.

                                     <rich:menuGroup value="Devices">
                                          <rich:menuItem submitMode="none"
                                               onclick="document.location.href='devices/registeredClientDeviceGroups.seam'">
                                               <h:outputLink value="devices/registeredClientDeviceGroups.seam?maxResults=25">
                                                    <h:outputText value="Registered Client Device Groups (Tabular)"></h:outputText>
                                               </h:outputLink>
                                          </rich:menuItem>
                                     </rich:menuGroup>     

                      This works - I can click on the devices menu item and the page is rendered.

                      But when I click on other menu items on the top level menu I get;

                      HTTP 404
                      type Status report

                      message /yyy/devices/xxx.seam

                      description The requested resource (/yyy/devices/xxx.seam) is not available.

                      Seam is inserting "devices" into the URL (somehow).

                      If I click on the same menu item without clicking on the devices menu item,it works fine.

                      I have clearly screwed up the default navigation model - what do I need to do to get view hierarchies working ?



                      • 8. Re: Subdirectory structure for Faceletes pages
                        kukeltje.ronald.jbpm.org

                        Wel, you do open a page in /yyy/devices/register.....seam and assuming yyy is you web context, all next requests in the menu are relative to this page unless made absolute. Basic jsf issues afaik, nothing to do with seam



                        • 9. Re: Subdirectory structure for Faceletes pages
                          qbit42

                          So there is no solution for the original problem??? I have exactly the same problem, but couldn't find a solution for that or why this behavior occured.

                          • 10. Re: Subdirectory structure for Faceletes pages

                            Matthias Preier wrote on Nov 18, 2009 15:23:


                            So there is no solution for the original problem??? I have exactly the same problem, but couldn't find a solution for that or why this behavior occured.


                            What original problem? If done properly nothing bad happens. This was (unless more evidence is presented) a developer mistake

                            • 11. Re: Subdirectory structure for Faceletes pages
                              stelestudent

                              So this is kind an old post, but I want to reply because I had the same problem recently, and discovered the cause of the problem.


                              So all you need to do in order for the subdirectory structure of xhtml pages to work, is
                              that you need to add / in front of url for the template attribute of ui:composition element in your xhtml page that is going to reside inside the subfolder of WebContent folder.


                              I hope this helps someone struggling with this question, and as much as it is hard to me not to comment other peoples posts on this one, I will not!!!


                              Cheers

                              • 12. Re: Subdirectory structure for Faceletes pages
                                qbit42

                                Hi, thanks a lot! Your answer saved my life for the second time. ;) Works 100%