当前位置: 首页 > wzjs >正文

wordpress实名认证西安seo管理

wordpress实名认证,西安seo管理,西安百度推广排名,北京企业网站改版1.javaee:意为java企业版,指java企业级开发的规范总和,包含13项技术规范 2.事实上服务器和客户端进行交互的过程中,有一个前端控制器在中间运作,这个控制器为DispatcherServlet,它负责将客户端请求的信息包…

1.javaee:意为java企业版,指java企业级开发的规范总和,包含13项技术规范

2.事实上服务器和客户端进行交互的过程中,有一个前端控制器在中间运作,这个控制器为DispatcherServlet,它负责将客户端请求的信息包装成HttpServletrequest对象,同时负责将服务器所传回的响应信息包装成HttpServletresponse对象.

3.获取请求参数的方式:

(1)原始方式:

package new_start.new_start4.controller;import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
public class ControllerHello {@RequestMapping("/simpleParam")public String simpleParam(HttpServletRequest request){String name = request.getParameter("name");String age = request.getParameter("age");int a = Integer.parseInt(age);System.out.println(name + "+" + age);return "ok";}
}

注意点:①getParameter的括号中必须加括号,表示字符串,且必须与请求参数的参数名一致;

②获取的是个字符串,需要自行进行转换;

(2)简单参数:

package new_start.new_start4.controller;import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
public class ControllerHello {@RequestMapping("/simpleParam")public String simpleParam(String name, Integer age){System.out.println(name + "+" + age);return "ok";}
}

第二种十分简洁,不需要进行类型转换;但要求形参名必须和请求参数名一致;

如果不一致,可以加上@RequestParam(name = “name”)注解:

package new_start.new_start4.controller;import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;@RestController
public class ControllerHello {@RequestMapping("/simpleParam")public String simpleParam(@RequestParam(name = "name") String username, Integer age){System.out.println( username + "+" + age);return "ok";}
}

同时该注解可以添加第二个参数:required;

默认为true,表示必须传入,否则报400错误,显示请求异常;

(3)实体对象参数:

这个需要创建一个实体类pojo,并用实体对象来接受请求参数,要求请求参数名必须对应实体类的属性名;同时有嵌套格式的话需要在请求时,进行加.的修饰:

例如:

package new_start.new_start4.controller;import jakarta.servlet.http.HttpServletRequest;
import new_start.new_start4.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;@RestController
public class ControllerHello {@RequestMapping("/pojo")public String pojo(User user){System.out.println(user);return "ok";}
}

(4)数组参数:

请求中只需要传值时使用同一个key值,同时这个key值等同于数组名即可;

package new_start.new_start4.controller;import jakarta.servlet.http.HttpServletRequest;
import new_start.new_start4.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;import java.util.Arrays;@RestController
public class ControllerHello {@RequestMapping("/hobby")public String hobby(String[] hobby){System.out.println(Arrays.toString(hobby));return "ok";}
}

同时还可以用集合,只不过要加上@RequestParam:

package new_start.new_start4.controller;import jakarta.servlet.http.HttpServletRequest;
import new_start.new_start4.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;import java.util.Arrays;
import java.util.List;@RestController
public class ControllerHello {@RequestMapping("/hobby")public String hobby(@RequestParam List<String> hobby){System.out.println(hobby);return "ok";}
}

(5)日期参数

(6)json参数:

通过json传递参数必须要用post请求方式,要把参数写在请求体中:同时用实体类接受,实体类的属性名和键名一致:但要注意形参名前要加@RequestBody

package new_start.new_start4.controller;import jakarta.servlet.http.HttpServletRequest;
import new_start.new_start4.pojo.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;import java.util.Arrays;
import java.util.List;@RestController
public class ControllerHello {@RequestMapping("/json")public String json(@RequestBody User user){System.out.println(user);return "ok";}
}(7)路径参数:注意要加@PathVariable,同时mapping路径映射要加{}来设定参数名
package new_start.new_start4.controller;import jakarta.servlet.http.HttpServletRequest;
import new_start.new_start4.pojo.User;
import org.springframework.web.bind.annotation.*;import java.util.Arrays;
import java.util.List;@RestController
public class ControllerHello {@RequestMapping("/path/{id}")public String json(@PathVariable Integer id){System.out.println(id);return "ok";}
}


文章转载自:

http://J3udx6EE.cwznh.cn
http://5809O3ql.cwznh.cn
http://PAY19giQ.cwznh.cn
http://i7Du3lWP.cwznh.cn
http://eK98hmYZ.cwznh.cn
http://Q6FdiMEo.cwznh.cn
http://JWX9klS5.cwznh.cn
http://ssrOTKRS.cwznh.cn
http://d4STZbeo.cwznh.cn
http://jPH931g8.cwznh.cn
http://7fz6mP9R.cwznh.cn
http://ilztar6m.cwznh.cn
http://M35W50HT.cwznh.cn
http://njroDOkP.cwznh.cn
http://oz7XcEYs.cwznh.cn
http://khq7htq8.cwznh.cn
http://GuMbZVOj.cwznh.cn
http://2ird8xc4.cwznh.cn
http://N3dM33kP.cwznh.cn
http://WUzsHymT.cwznh.cn
http://heT1hGj9.cwznh.cn
http://vvZ6zthZ.cwznh.cn
http://zPAFzWvQ.cwznh.cn
http://7SpfBVqy.cwznh.cn
http://dRAw3PKZ.cwznh.cn
http://1hoRdc0e.cwznh.cn
http://b6LWvfds.cwznh.cn
http://JGfoSHUB.cwznh.cn
http://DWiCqYsW.cwznh.cn
http://WEup3bgU.cwznh.cn
http://www.dtcms.com/wzjs/676477.html

相关文章:

  • html做的网站图片横着摆放汉中做网站公司
  • 香飘飘网站平台建设wordpress菜单导航栏
  • 在工商网站上怎么做电话的变更厦门营销网站制作
  • 网站多域名怎么做广州天河区医院
  • 推荐做幻灯片搜图网站十大免费域名
  • 中国人寿寿险保险公司官方网站一个外贸网站要多大的空间比较好
  • 国家住房和城乡建设部中国建造师网站做刷单哪个网站找小白
  • 网站被抄袭怎么办机械外发加工网
  • 内蒙古建设厅网站官网建设工程建筑网
  • dns加网站海淀网站建设服务
  • 山西工程项目视频制作公司北京seo营销培训
  • 美橙网站建设wordpress网站非常慢
  • 东莞英文网站制作wordpress安卓版教程
  • 中国建设门户网站深圳住房和建设厅网站
  • 东莞知名网站推广单一本地门户网站源码
  • 网站后台添加图片显示不了类似wordpress的图片上传
  • 成都网站建设托管安顺市网站建设
  • 贵阳网站设计推广普通话的内容
  • 泰安房产网签住宅常用的seo网站优化排名
  • 湖南3合1网站建设一个网站如何做盈利
  • 阿里云网站域名证书免费网站建设必找186一6159一6345
  • 做查询网站有哪些网站上做扫一扫
  • 可以做超大海报的网站阿里云网站建设素材
  • 家具设计网站大全wordpress 去掉分类
  • 网络营销推广方法集锦大连seo外包公司
  • 最近一周新闻无锡网络优化推广公司
  • 迪庆州住房和城乡建设局网站华为云云速建站
  • 螺栓球网架seo常用的工具
  • wp网站模板安装网站开发售后工作
  • 福州网站建设哪家强网站开发项目扶持政策有哪些