0

Spring 3.0.5 + Tiles

Inside my controller I'm creating a new ModelAndView but a situation has come up where one company wants their own view. Once this happens I can see this growing where other's want their own as well.

@RequestMapping(params="companyId")
public ModelAndView newCompanyView(HttpServletRequest request, String companyId) {
    // right here I'd like to check if the "companyABC" view is a defined tile
    // and if it is the send that back as a view and I can eliminate a bunch of if
    // checks. 
    if(companyId.equals("ABC")) {
        return new ModelAndView("companyABC", "vo", getCompanyVo());
    } else {
        return new ModelAndView("company", "vo", getCompanyVo());
    }
}

Is this possible and if so then how?

kasdega
  • 18,396
  • 12
  • 45
  • 89

2 Answers2

0

I think you might be interested in Spring's support for themes, which can inherit from each other and fallback to a default.

matt b
  • 138,234
  • 66
  • 282
  • 345
  • already looked into spring's theme support but unfortunately the customer doesn't just want the page to look different, they want different functionality. The page I need is almost a completely different page. In fact I may just go down that road if something like I'm asking isn't possible. – kasdega Oct 03 '11 at 18:44
0

Apparently there really isn't a good way to do this unless you really want to dive head first into fiddling with view resolvers. I don't have the time or the desire to try and figure it out but if someone smarter than I has some time I'd love to hear a solution. Until then I'm just going to punt and have some IF checks for special companies.

kasdega
  • 18,396
  • 12
  • 45
  • 89