Return only string message from Spring MVC 3 Controller

后端 未结 7 663
死守一世寂寞
死守一世寂寞 2020-11-28 04:50

Can any one tell me how I can return string message from controller?

If i just return a string from a controller method then spring mvc treating it as a jsp view nam

7条回答
  •  温柔的废话
    2020-11-28 05:09

    What about:

    PrintWriter out = response.getWriter();
    out.println("THE_STRING_TO_SEND_AS_RESPONSE");
    return null;
    

    This woks for me.

提交回复
热议问题