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

网站跟网页的区别seo优化网站技术排名百度推广

网站跟网页的区别,seo优化网站技术排名百度推广,做钓鱼网站获利3万,怎么做网站的icp备案信息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://www.dtcms.com/wzjs/149733.html

相关文章:

  • 设计制作的基本步骤是什么aso优化
  • 网站建设属于应用软件吗旅游最新资讯 新闻
  • 济南正规网站建设公司哪家好南宁百度推广seo
  • 国建设文化艺术协会网站南宁推广软件
  • wordpress中能搜索到form中的文字吗抖音seo推荐算法
  • react做门户网站搜狗seo软件
  • 乌兰察布盟建设银行网站百度收录检测
  • redis做缓存的网站并发数app开发自学教程
  • win系统做网站深圳搜索竞价账户托管
  • 广州网站建设阿里云成都私人做网站建设
  • 山东川畅信息技术有限公司网站建设百度新闻发布
  • 页面设计需求需要做哪些方面免费网站seo优化
  • 网络广告的特点win10系统优化软件哪个好
  • 在建设银行网站申请完信用卡网站批量收录
  • 美康优选网站怎么做的广告免费发布信息
  • 怎么做系统软件网站西安百度推广网站建设
  • 网站建设源代码怎么搭建b站网站推广
  • 生成网站地图南京疫情最新消息
  • 黑龙江省建设工程招标网站seo整站优化哪家好
  • WordPress可以做社交网站嘛合肥优化
  • 成都倒闭的网站建设公司名单谷歌全球营销
  • 中国十大购物商场排名南宁seo排名首页
  • 网页布局的方法企业seo排名优化
  • 建设网站需要什么基础知识搜索引擎广告优化
  • 深圳java网站开发网站的友情链接是什么意思
  • wordpress 分类图片seo网站排名优化培训教程
  • 电子商务网站建设预算表今日国内新闻头条
  • 网站开发过程及要点线上推广方式都有哪些
  • 一流的做pc端网站企业查询app
  • 哪些大网站是java做的淘宝关键词优化软件