-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.xml
46 lines (21 loc) · 4.18 KB
/
search.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>ResponseBody和RequestBody</title>
<link href="/2022/12/03/ResponseBody%E5%92%8CRequestBody/"/>
<url>/2022/12/03/ResponseBody%E5%92%8CRequestBody/</url>
<content type="html"><![CDATA[<h2 id="tags"><a href="#tags" class="headerlink" title="tags:"></a>tags:</h2><hr><p>author: hyp<br>cover: /medias/3.jpg<br>tags:</p><ul><li>注解<br>categories:</li><li>springmvc注解</li></ul><hr><p>@ResponseBody和@RequestBody一般是在服务器端的controller中使用</p><p>@ResponseBody注解的作用是将controller的方法返回的对象通过适当的转换器转换为指定的格式之后,写入到response对象的body区,通常用来返回JSON数据或者是XML数据</p><p>@RequestBody主要用来接收前端传递给后端的json字符串中的数据的(请求体中的数据的)</p><p>@RequestBody与@RequestParam区别</p><ul><li>区别<ul><li>@RequestParam用于接收url地址传参,表单传参【application/x-www-form-urlencoded】</li><li>@RequestBody用于接收json数据【application/json】</li></ul></li><li>应用<ul><li>后期开发中,发送json格式数据为主,@RequestBody应用较广</li><li>如果发送非json格式数据,选用@RequestParam接收请求参数<br></li></ul></li><li>注意事项:<ul><li>1.如果一个方法上没有加入ResponseBody注解,则Spring会将方法的返回值封装为一个ModelAndView对象返回</li><li>2.如果一个方法上加入了ResponseBody注解时,当返回值是字符串时,则返回字符串至客户端<br>如果返回值是一个对象时,则将对象转换为json串,返回到客户端</li><li>3.Responsebody返回值的编码需注意,<br>如:<pre><code>RequestMapping(value="/getUsers",produces="text/html;charset=utf-8")</code></pre></li></ul></li></ul>]]></content>
</entry>
<entry>
<title>test</title>
<link href="/2022/12/02/test/"/>
<url>/2022/12/02/test/</url>
<content type="html"><![CDATA[<h2 id="tags"><a href="#tags" class="headerlink" title="tags:"></a>tags:</h2><p>作者:胡曜鹏<br><br>邮箱:<a href="mailto:2914573041@qq.com">2914573041@qq.com</a></p>]]></content>
</entry>
<entry>
<title>Hello World</title>
<link href="/2022/12/01/hello-world/"/>
<url>/2022/12/01/hello-world/</url>
<content type="html"><![CDATA[<p>Welcome to <a href="https://hexo.io/">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues">GitHub</a>.</p><h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><pre><code class="bash">$ hexo new "My New Post"</code></pre><p>More info: <a href="https://hexo.io/docs/writing.html">Writing</a></p><h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><pre><code class="bash">$ hexo server</code></pre><p>More info: <a href="https://hexo.io/docs/server.html">Server</a></p><h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><pre><code class="bash">$ hexo generate</code></pre><p>More info: <a href="https://hexo.io/docs/generating.html">Generating</a></p><h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><pre><code class="bash">$ hexo deploy</code></pre><p>More info: <a href="https://hexo.io/docs/one-command-deployment.html">Deployment</a></p>]]></content>
</entry>
</search>