1

Suppose that I have this project Structure (In this case the classical WebContent Folder was renamed as Interface):

(Eclipse IDE and omitting libraries)

Java Example
   -src
      -businessLogic
      -data
      -domain
      -exceptions
   -Build
   -Interface
      -Beans
      -META-INF
      -Views
      -WEB-INF

As you can see I want to have a N-tier architecture but grouping beans with the Views (my .xhtml files) inside the Interface layer and then they will interact with other layers (with Business Logic first and so on) so I can have a well structured project, however, I don't know if placing java classes under the Interface folder is 'legal', allowed or considered a poor practice, if that's true, How could I achieve this architecture?.

This is the architecture that I have in mind:

                   E     Interface      D
                   X                    O
                   C   businessLogic    M
                   E                    A
                   P       Data         I
                   T                    N
                   I
                   O
                   N

Exception and Domain are transversal Layers because they will be used in the other layers, Exception is my layer with my own exceptions created and domain is the layer where my POJO will be (User class, Company class, etc.).

I want to do this because, since JSF is an MVP framework, I want to group all of those contents (.xhtml and Beans) in the "top" layer (I want to use MVP as a design pattern), am I misunderstanding the MVP architecture of JSF?

Thanks in advance.

P.D: I would like to put images but unfortunately I can't yet.

Teddy S.
  • 33
  • 8
  • the architecture or pattern has little to do with where you choose to put your files. – pvg Sep 14 '17 at 19:53
  • That means I can place my beans under the root of my web application? (Interface). – Teddy S. Sep 14 '17 at 19:57
  • I think you should use JSF as anybody uses it and drop trying to follow the MVP stuff as it is (like MVC) not 1:1 applicable to web based applications. But if you want separation at the project level too, just create multiple jars, one for the web layer (web fragment if you want to have xhtml in it to), and one for the businesslogic. https://stackoverflow.com/questions/35034544/how-to-structure-a-multi-modules-maven-project-to-compile-it-at-once or https://stackoverflow.com/questions/14467325/maven-combining-multiple-module-jars-into-one-war-file – Kukeltje Sep 14 '17 at 20:07
  • This sounds a good a idea, I just want to point out that (as far as I understand) JSF it matches with MVP see https://stackoverflow.com/questions/36580401/why-is-jsf-considered-mvp-but-not-mvvm-framework – Teddy S. Sep 14 '17 at 20:17
  • Yes, but take it as it is, not try to force it into the way you read it in the 'academic' articles about it.;-) – Kukeltje Sep 14 '17 at 20:57

0 Answers0