Hello,


a rather general question about a problem I have had many times,
but never found a really satisfying solution as to how to go
about it.

Lets say I am developing a browser based application with several
users, some of them having different roles. The application
consists of some html pages which all the users acess.

But each role requires the user to see different information.
E.g. a user with an elevated role might be able to see
additional information. Sometimes a role requires a specific
information be shown at another place on the website.

Still the common aspects outweight the differences.

Now my question is how to modell such a programm in a sustainable
way on the server side?

I might use a scripting technology such as jsp or perl, but
as the site grows I end up with endless cascades of if end
clauses and a lot of duplicated code.

I could use a templating system, but still I wouldn't have found
a solution to the "if else cascade", since there would still
be many conditionals in the template, making things unstructured.

What I have thought about was that I might need sort of a
"template in the template" system, provinding the opportunity
to insert smaller templates into a master template.
This could be made possible by just inserting html code,
generated by helper classes into the master template, but still
its does not seem to be easy enough to me.


I would be very much interested in how you solve such kind
of problems! Are there any design patterns you use?

thanks a lot!
Timo