4

I'm doing a project with JSF. I have created a page that displays information about some movies. Everything works so far. Now I want to implement the possibilty to display information about tv series as well. For this I'd like to bin everything that has do with displaying movies into a subproject that will produce a .jar-file which I then will include in my main project. For the tv series I'll make the same thing.

At the moment I have just this one project and it's structered like this (I show only the relevant parts):

wgmdb.war
 \_ src
     \_ main
         \_ webapp
             \_ view
                 \_ overview.xhtml
                 \_ movies
                     \_ details.xhtml

In my overview.xhtml I include details.xhtml like this:

My goal is something achieve now something like the following, where wgmdb-movies.jar is a library included by the main project:

wgmdb.war
 \_ src
     \_ main
         \_ webapp
             \_ view
                 \_ overview.xhtml

wgmdb-movies.jar
 \_ src
     \_ main
         \_ resources
             \_ details.xhtml

The problem is now, that I have now idea how to include details.xhtml from the library into the overview.xhtml of the main project. What src path must I use that details.xhtml will be found?

Best regards,

metalhamster

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
metalhamster
  • 95
  • 1
  • 10

1 Answers1

10

The details.xhtml has to end up like /META-INF/resources/details.xhtml in the JAR. This way you'll be able to just use <ui:include src="details.xhtml">.

In Maven perspective, that would be /src/main/resources/META-INF/resources/details.xhtml.

See also:

Community
  • 1
  • 1
BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
  • Thanks a lot. It works for every file, except for one... For movie_cover.xhtml I get javax.faces.FacesException: Error Checking Last Modified for jndi:/server/wgmdb/view//oauth-v2-spec/movie_cover.xhtml although movie_cover.xhtml is in the same directory as overview.xhtml and is included exactly the same. – metalhamster Dec 06 '13 at 10:06
  • I know, but I have no idea were it comes from. For the other files it doesn't happen. For me it looks like the in overview.xhtml searches for the source in the same directory and doesn't find the file... – metalhamster Dec 06 '13 at 10:15
  • Well, then it's either a typo in path or actual file or a build fail. – BalusC Dec 06 '13 at 10:18
  • Ok, I found the problem. The file was include in another place as well and there I included it differently with another slash before the actual path with resulted in the double slash. ;-) – metalhamster Dec 06 '13 at 10:48