简体   繁体   English

如何使用@ResponseBody和@RequestBody?

[英]How to use @ResponseBody and @RequestBody?

我正在阅读spring 3.0.x参考,但我不知道如何使用,您可以粘贴完整的示例吗?

Use @ResponseBody if you want to return the content directly without any JSPs. 如果要直接返回没有任何JSP的内容,请使用@ResponseBody

@RequestMapping("blubber")
@ResponseBody
public String blubber() {

    return "<html><body>Hello World</body></html>
}

If you do a search for 如果您搜寻

spring @ResponseBody lang:java 春天@ResponseBody lang:java

and

@RequestBody lang:java @RequestBody lang:java

in Google Code Search, you can see numerous usages of @ResponseBody and @RequestBody there that might help you understand it better. 在Google代码搜索中,您可以看到@ResponseBody@RequestBody大量用法,这些用法可能有助于您更好地理解它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM