Results 1 to 4 of 4

Thread: I just want my view to come from a POJO

  1. #1
    Join Date
    Dec 2005
    Posts
    25

    Default I just want my view to come from a POJO

    Hello,
    This may win the award for the dumbest question yet. But I've just started moving all my view rendering from JSP's to POJO's. I just don't want to bother with JSP anymore. So since I'm gutting everything, I thought this would be a good time to make the leap from Struts to Spring MVC as well. Anyway, I'm just getting started. I went through the doc and a tutorial. So I see how to forward to a JSP by doing something like, "return new ModelAndView("test.jps")" in the controller.... but I'm not using JSP. I'm thinking my answer might be the "Integrating view technologies" section of doc. But I'm just not getting it.

    Any hints on how to do something simple like..
    return MyObject.toHtml()?

    Thanks

  2. #2
    Join Date
    Dec 2005
    Posts
    25

    Default

    Never mind. The reference guide wasn't really clear to me. However, the API documenation for ModelAndView cleared it all up.
    All I needed to do was create a class implementing View, then write directly to the HttpServletResponse, create an instance of it and pass it back as part of the ModelAndView wrapper. Pretty simple.

  3. #3
    Join Date
    Aug 2004
    Posts
    123

    Default

    Quote Originally Posted by jones
    Hello,
    This may win the award for the dumbest question yet.
    Sorry, I believe I've already won that for this year.

  4. #4
    Join Date
    Dec 2005
    Posts
    25

    Default

    Ha ha.. well you've got some serious competition now

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •