Multiple possible jsp views for a request
- by Karl Walsh
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.
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.
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.