Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking to offer the user some way of changing how a single page looks based on some pre-defined jsps.

i.e. Two or more jsp's contain similar information, and would be backed by a single controller method. The controller would decide which view to return.

  1. Is there a common way of achieving this?

    At the moment I have some administration screens where I control a list of possible views. The user can then choose which one to see from a drop-down.

    My current issue is that I don't know how to confirm (at the admin screen) that the view is valid.

  2. Is there a way of asking spring for all possible views so I can filter them and resent a drop-down on the admin screen rather than a free text field? If not is there a way of asking spring if a single view is valid?

    All these views will reside under a common directory, so it would probably be possible to scan recursively from that point and build a list of possible views.

This goes beyond simply changing the css, since the page content might be different despite being backed by the same model.

share|improve this question
up vote 0 down vote accepted

I think this needs some File system scanning in the back end at sprig container and Ajax calls in the Admin Screen this both combined will give you a solution I suppose.

My solution would be, when the client hits the Admin screen and tries to change the view then send the Ajax call to the server, The server instantly scans the list of all Views in the directory, (This is a "File" based scanning as you have explained) and returns Names of the views removing the extensions and in User readable format. (The view names should me user readable).

Try this. Ramakanth

share|improve this answer
Thanks Ramakanth, it's something I have considered. The views are configured in an admin screen so for now we do this manually (i.e the user is required to know the view path and css filename). Then the non-admin user can be presented with a list of views only an admin has added. I think this is the path we're going to take at-least for the short term. Thanks again. – Karl Walsh Dec 16 '11 at 16:27
Not to worry. If you get it working give me a ping. I will be glad. – TRR Dec 20 '11 at 9:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.