Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include a xhtml from an external jar

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

like image 652
metalhamster Avatar asked Dec 05 '13 15:12

metalhamster


Video Answer


1 Answers

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:

  • Structure for multiple JSF projects with shared code
like image 68
BalusC Avatar answered Nov 03 '22 09:11

BalusC