Question

I am looking to borrow someone's brains (& experience) to figure out an optimum way to implement the below.

I am currently working on an application which will be used by many of our clients and will require UI customizations according to each client's requirements. Although the underlying java code as well as business logic will be the same, at runtime I would like to figure out (via some property) which client the application is running for and thus, choose the corresponding view and display the web page.

Currently, all I could think of is to create a custom ViewResolver (extending InternalResourceViewResolver) that will read the client name property and use this to resolve a view (eg: WEB-INF/jsp//account/myAccount.jsp) or default to another view (eg: WEB-INF/jsp/default/account/myAccount.jsp) if client property not present.

The issue I see here is that I might not want to overwrite all my JSPs for a particular client where the default view should be rendered. This will require an I/O Call to check the existence of the JSP file in the client's folder before reverting to the default. To counter the I/O I can even create a Map of overwritten JSPs at application startup but this will require an application restart on addition of new customized JSPs which again can be handled by exposing some service to refresh this Map.

So what do you guys think? Also, how will it affect redirects? Plz let me know if you need any further information about our setup or requirement.

Regards,
Sumit

Was it helpful?

Solution 2

After waiting for more comments / suggestions, as JB suggested, going with my own solution as described in the question itself.

Thanks all for your help.

OTHER TIPS

You can use tiles to control the rendering of your view it has a default view resolver bundled with spring and you can extend that.

Define custom layouts, extend them and change it in case you want another behavior.

http://tiles.apache.org/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top