This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Different client view in J2EE app

 
Vicky Pandya
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

Thanks,
Ramesh
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ashwin Pai
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ajay dev
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could also use the ApplicationController pattern to handle different kinds of clients like Rich-GUI clients (Swing/AWT), Web clients.
 
ruben delcastillo
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic