Architecture: How to realize this web app in Java EE + JSF2? [revised] [closed]
Being new to web app dev, I'm currently insecure what architecture would best work for an eCommerce web app including enduser programming where privileged endusers (managers) can declaratively define via a manager online tool
(a) additional enduser roles (like customer types),
(b) categorized products/services, (c) product prices in dependence of customer type, buy period, quantity and granted discountsand also manage and monitor the own site entities (customers, sales, revenues, etc).
Managers should be able to preview their specs and finally publish them under a specific site URL (base URL given by the system). Endusers can navigate through the resulting site for gathering information and submitting orders.
My 2 main problems originate from the included declarative enduser program开发者_Python百科ming in the manager tool. I'm currently wondering about:
- how and where to render the preview/publication results from the declarative format "on the fly", and
- how to provide a flexible pricing mechanism that makes pricing rules management easy.
- As to (1) one could go with a pure JSF2 Ajax approach (only server-side renderings) or a JSF2+JS(jQuery) Ajax approach (to be more responsive at client side) ... But how may I realize a rendering component, especially when jQuery is involved?
- As to (2), a rule-based approach is imaginable, but I'm currently not sure if a rules-engine-involving server-side subsystem like JBoss Drools would be (a) too "heavy-weight" for this kind of pricing rules, and (b) inappropriate when taking into account that a client-side "light-weight" rules interpreter version could do the same job (?) and also be reused for interpreting necessary forms controlling rules! I guess for the prices' visualization and input an "(editable) hypercube widget"-approach could also be a good thought. (Btw., do someone know about such widgets for JSF2?)
Still hoping that here I can obtain some advice from more experienced Java EE developers:
Which Java EE architecture would you use to solve the above-stated goal in a good way?The main concern is to choose components for the different architectural elements that you implicitly mentioned in the above text. A very common approach is to layer your applikation and begin your design in a more conceptual matter, after that you can start to evaluate different implementing techniques and decide what is best suited for your needs.
You probably want to store data? Then a db-tier is nessecary, a candidate for this might be Hibernate or JPA2.
If your are likly to need the developed business logic in an other context than your webb-app (re-usability), eg provide a web service or similar it´s a good idea to create a separate business tier that encapsulates your code in defined methods (often matched to business processes). In this way you can use the same logic for different consumers ie a webb app and a webb service. EJB´s and SessionBeans are a common sollution to this area.
A modern approach for the presentationlayer is to use a kombination of ManagedBeans and JSF2/facelets, and to avoid inventing all presentation components by yourself you can use a componentlibrary like IceFaces/PrimeFaces/Richfaces. JSF components libraries often rely on jQuery and have it bundled.
So to sum up you probably gonna need:
Presentation tier - JSF2/ManagedBeans and one component library such as PrimeFaces, IceFaces, RichFaces etc. (http://www.primefaces.org/)
Business Logic tier - EJB SessionBeans is a powerful techique ( http://download.oracle.com/javaee/6/tutorial/doc/, http://seamframework.org/)
Persistence tier - Hibernate/JPA2, JPA2 is bundled in the EE 6 download from oracle.
Netbeans provide downloads with a bundle of glassfish 3 for EE 6 that is easy to install and use.
Good luck!
精彩评论