This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Approach for making a Web app Customizable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Approach for making a Web app Customizable" Watch "Approach for making a Web app Customizable" New topic

Approach for making a Web app Customizable

Jilesh Lakhani
Ranch Hand

Joined: Jul 26, 2006
Posts: 49

Hi guys I need your suggestion / thoughts / inputs;

For a Web application already developed and then comes the request to make it customizable for every client (Like we normally have) what would be the best approach for this.
well, normally many developers have this if else condition, if x user do this else do this I am kinda against this as this has loads and loads of issue and is buggy.
One approach which I've thought of is maintaining the global XML which will have all the configuration for all the users we want to have. and make changes to the pages accordingly.

Do we have any other ideas ??

Universe and Knowledge has no bounderies
Anurag Blore
Ranch Hand

Joined: Jan 15, 2003
Posts: 74
There could be different type of customization and the design should be based on what is required

Is it just a look n feel change(colour n menu using stylesheet) or some additional functionality change or
you are talking about a product where some features are given to customer who paid for that and some client can live with less features. Based on above thoughts we should think about design.

SCJP 1.2 & 1.5, PMP
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41054
I'd probably make it DB-based, not file-based. Databases give you more flexibility to make changes dynamically.

You need to think about which customizations should be possible, how the relevant data is stored in the DB, and how users can go about changing them.

For starters, you need the users to log into your application so that you can identify them. Then you can look up any customizations based on their user ID (or company ID or whatever, if these customizations apply to groups of users).

Ping & DNS - my free Android networking tools app
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Learn how to use locale-sensitive objects to customize your Java-based Web applications.

public final class java.util.Locale extends Object implements Cloneable, Serializable

A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user. For example, displaying a number is a locale-sensitive operation--the number should be formatted according to the customs/conventions of the user's native country, region, or culture.

public abstract class java.util.ResourceBundle extends Object

Resource bundles contain locale-specific objects. When your program needs a locale-specific resource, a String for example, your program can load it from the resource bundle that is appropriate for the current user's locale. In this way, you can write program code that is largely independent of the user's locale isolating most, if not all, of the locale-specific information in resource bundles.

Jilesh Lakhani
Ranch Hand

Joined: Jul 26, 2006
Posts: 49

umm, well Firstly I am not talking about CSS changes, I am talking about features.
Database driven is one solution would be the best one but also one of the lengthy & neat process, (creating back end UI to control things).

XML is not so lengthy but not neat either.

any other suggestions??
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
umm, well Firstly I am not talking about CSS changes, I am talking about features.

What "features" are you referring to?

If you described a particular feature, then maybe other readers will provide germane design suggestions.
Jilesh Lakhani
Ranch Hand

Joined: Jul 26, 2006
Posts: 49

let me think about a example.....

Readers Note that this is a Hypothetical example.

Lets say its about a E-commerce website, where our clients are the vendors, they can show up their products so the end users can purchase it.

So there is a standard system ready for them it also implements CSS changes for every clients.
Now there are product showcase or a sidebar showing recommended products.

Here one client (out client) says that my site should show "Most Purchased Item" instead of "Recommended Products".
and well we could have small small request too.

like a client could say : I would like my customers to print the product information and other one could say i don't want them to have print option!!

now these requests can keep on pouring in as the product grows, here I am looking for an good option where we can incorporate all these customizable change request from time to time.

hopefully this example should give you a better perspective of the issue raised.

till now there are two suggestions
1) XML (Not a Neat Process but short)
2) Database (Neat and lengthy)
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187

For the type of customization you described, the standard commercial solution is to have configuration data stored in a commercial-quality relational database.

You are associating the term "lengthy" to a standard operation. It is unlcear what your interpretation of "lengthy" means.

Your idea for reading a giant XML file that contains all the customization data for all of the client accounts is not really a healthy option for a commercial quality system. It is problematic in many ways and presents a resource contention bottleneck as well is probable I/O issues with multiple clients reading the file concurrently, not to mention version issues if you attempt to replicate the file.

However, to implement a solid, efficient database solution, you need the right skill sets, e.g. database administration, database design, knowledge of pooling and how to write database-driven software.
Jilesh Lakhani
Ranch Hand

Joined: Jul 26, 2006
Posts: 49

Lengthy just means, it takes lot of time to implement but I agree its a best approach as it would reduce the bugs also its easy to maintain.

Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
There is a significant difference between using an XML-based configuration file at application start-up or deployment and runtime.

XML-based configuration files such as struts-config.xml, web.xml, ejb-jar.xml are read only once when an application is deployed.

The runtime customizations that are described above typically need a more dynamic storage mechanism such as a relational table in a relational database management system.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299

You really should just read up on how a CMS works. I'm not saying you should use an out of the box CMS, but you should be aware of how one works because it is basically what you might need.

GenRocket - Experts at Building Test Data
I agree. Here's the link:
subject: Approach for making a Web app Customizable
Similar Threads
lots of ifs and elses what's wrong here?
Properties file in EJB Ear
A general question,
Why is IDEA 400 bucks?
Struts Tiles Tutorial