get contents of processed JSP into spring controller without using HttpClient?

前端 未结 1 554
野性不改
野性不改 2021-01-02 23:40

So normally in a Spring controller you\'d just return a ModelAndView object and forward the request to the JSP.

What I need to do is actually get the co

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-02 23:47

    Probably not possible easy way. Maybe injecting view resolver into controller and calling render with special response will help, but not sure :

    ViewResolver viewResoler = // injected
    View view = viewReslover.resolveViewName(String viewName, Locale locale);
    HttpServletResponse xresponse = // custom response, buffers data
    view.render(Map model, HttpServletRequest request, HttpServletResponse xresponse);
    String content = // extract conten from data from xresponse 
    

    '

    0 讨论(0)
提交回复
热议问题