Multiple possible jsp views for a request

Posted by Karl Walsh on Programmers See other posts from Programmers or by Karl Walsh
Published on 2011-11-28T22:04:15Z Indexed on 2011/11/29 2:08 UTC
Read the original article Hit count: 555

Filed under:
|
|

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.

© Programmers or respective owner

Related posts about java

Related posts about spring