aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Different client view in J2EE app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Different client view in J2EE app" Watch "Different client view in J2EE app" New topic
Author

Different client view in J2EE app

Vicky Pandya
Ranch Hand

Joined: Dec 16, 2004
Posts: 148
I have an application which requires different view per client. Currently application is being used only for one client and now is expanding to support multiple clients. Although basica functionalities of the application remain same client wants to see Home page and otehr pages most customized per their preference. E.g. Client A wants to see their business specific attributes and things on pages whereas client B as its own list of things it want to see on all pages. what's the best way to achieve this?
J J Wright
Ranch Hand

Joined: Jul 02, 2008
Posts: 254
If the changes are really radical you could go as far as providing a separate WAR for each client - I'm assuming most the logic is implemented in an EJB tier. However, that would really trample all over the DRY principle and could be a maintenance nightmare.

If you're going to have heaps of clients, and they all want to customize their view, then maybe you could try using a kind State pattern object. Store client preferences in a database table mapped to an entity. Based on the current client use the entity as a kind of 'state' which gets delegated to when determining if a component gets displayed. This way you avoid an explosion of nasty conditional statements all over the place. If you're using JSF it'd be a piece of cake to hook this into the 'rendered' property.


SCJP, SCWCD, SCBCD, SCEA 5
Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 402
I dont think even changes are critical, separate WARs for client is a good fix.

I recommend an Intercepting Filter for selecting the view for each client. Easiest way is repeating the view of changing pages for each client type.

Without doing everything from scratch you can go for a framework like SiteMest http://www.opensymphony.com/sitemesh/. That will help to minimize the repeatings

Regards




vikram kumar
Ranch Hand

Joined: Aug 01, 2005
Posts: 58

According to me using Sturts tiles will be the best option to address this requirement.

Thanks,
Ramesh
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
I think the easiest way is to use dynamic views, this views display differently based upon client preference.

In view layer, you can read client preference and render differently.


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Ashwin Pai
Ranch Hand

Joined: May 20, 2008
Posts: 90
Vicky Pandya wrote:I have an application which requires different view per client. Currently application is being used only for one client and now is expanding to support multiple clients. Although basica functionalities of the application remain same client wants to see Home page and otehr pages most customized per their preference. E.g. Client A wants to see their business specific attributes and things on pages whereas client B as its own list of things it want to see on all pages. what's the best way to achieve this?


Your description is too abstarct.. What exactly do you mean by different clients want different things on the pages? Can you be more specific about the requirement ? Is it just different customizations of the page from a UI perspective or is it customizing the core data/functionality on each page or something else ?

Approaches could vary in their complexities based on what you want to do.

Regards
Ashwin


The only way to make your dream come true is to wake up.
Ajay dev
Greenhorn

Joined: Jan 12, 2009
Posts: 11
You could also use the ApplicationController pattern to handle different kinds of clients like Rich-GUI clients (Swing/AWT), Web clients.
ruben delcastillo
Greenhorn

Joined: Apr 27, 2008
Posts: 8
Hello,
i thik composite view pattern could be applied as well,i what is required is varing client view based in security roles and other policies,such location and intenationalization.Combinatios of Front Controller, State and Composite View could help to achieve this goal.
 
Don't get me started about those stupid light bulbs.
 
subject: Different client view in J2EE app