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

怎样做QQ网站呢网站增加域名备案

怎样做QQ网站呢,网站增加域名备案,开发网站的基本流程五个阶段,好用的黄页网转自#xff1a; https://blog.csdn.net/cockroach02/article/details/82194126https://blog.csdn.net/cockroach02/article/details/82194126 一、当前现状 浏览器使用form提交信息的时候只支持GET和POST#xff0c;如果需要在浏览器上使用PUT和DELETE请求方式的话#…转自   https://blog.csdn.net/cockroach02/article/details/82194126https://blog.csdn.net/cockroach02/article/details/82194126 一、当前现状 浏览器使用form提交信息的时候只支持GET和POST如果需要在浏览器上使用PUT和DELETE请求方式的话只能使用欺骗的方式了SpringMvc提供了HiddenHttpMethodFilter类来提供支持请看代码 public class HiddenHttpMethodFilter extends OncePerRequestFilter {/** Default method parameter: {code _method} *///我们的隐藏字段name必须为_methodpublic static final String DEFAULT_METHOD_PARAM _method;private String methodParam DEFAULT_METHOD_PARAM;/*** Set the parameter name to look for HTTP methods.* see #DEFAULT_METHOD_PARAM*/public void setMethodParam(String methodParam) {Assert.hasText(methodParam, methodParam must not be empty);this.methodParam methodParam;}Overrideprotected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)throws ServletException, IOException {HttpServletRequest requestToUse request;if (POST.equals(request.getMethod()) request.getAttribute(WebUtils.ERROR_EXCEPTION_ATTRIBUTE) null) {String paramValue request.getParameter(this.methodParam);if (StringUtils.hasLength(paramValue)) {requestToUse new HttpMethodRequestWrapper(request, paramValue);}}filterChain.doFilter(requestToUse, response);}/*** Simple {link HttpServletRequest} wrapper that returns the supplied method for* {link HttpServletRequest#getMethod()}.*/private static class HttpMethodRequestWrapper extends HttpServletRequestWrapper {private final String method;public HttpMethodRequestWrapper(HttpServletRequest request, String method) {super(request);this.method method.toUpperCase(Locale.ENGLISH);}//通过继承方式对getMethod方法做了下改变就变成了PUT或者DELETE了Overridepublic String getMethod() {return this.method;}}} 二、配置步骤 1. web.xml !-- HTTP PUT Form --filterfilter-nameHiddenHttpMethodFilter/filter-namefilter-classorg.springframework.web.filter.HiddenHttpMethodFilter/filter-class/filterfilter-mappingfilter-nameHiddenHttpMethodFilter/filter-nameurl-pattern/*/url-pattern/filter-mapping 2. putform.jsp % page languagejava contentTypetext/html; charsetUTF-8 pageEncodingUTF-8% !DOCTYPE html html head meta http-equivContent-Type contenttext/html; charsetUTF-8 titleInsert title here/title /head bodyform methodPOST action%request.getServletContext().getContextPath()%/home/putformBodyinput typehidden name_method valuePUTp姓名/pinput typetext namename /br/p性别/pinput typetext namesex /br/p年龄/pinput typetext nameage /br/button typesubmit提交/button/form /body /html 3. putformBodycontroller方法 RequestMapping(pathhome/putformBody, methodRequestMethod.PUT, produces text/plain;charsetutf-8)ResponseBodypublic String putformBody(HttpServletRequest req, HttpServletResponse resp) {String name req.getParameter(name);String sex req.getParameter(sex);String age req.getParameter(age);return name: name ,sex: sex ,age: age;} 四、中间遇到的坑 1、拦截器的url-pattern必须配置为/*不能配置/否则不生效 2、为对中文支持避免乱码配置CharacterEncodingFilter必须为放在第一个否则即使是配置生效断点调试能进去但是依然中文乱码初学的朋友参考web.xml如下 ?xml version1.0 encodingUTF-8? web-app version3.0 xmlnshttp://java.sun.com/xml/ns/javaeexmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsddescriptioncockroach-springmvc-xml/descriptioncontext-paramparam-namecontextConfigLocation/param-nameparam-valueclasspath*:applicationContext.xml/param-value/context-paramservletservlet-namespringmvc/servlet-nameservlet-classorg.springframework.web.servlet.DispatcherServlet/servlet-classinit-paramparam-namecontextConfigLocation/param-nameparam-value/WEB-INF/springmvc-servlet.xml/param-value/init-paramload-on-startup1/load-on-startup/servletservlet-mappingservlet-namespringmvc/servlet-nameurl-pattern//url-pattern/servlet-mapping!-- UTF-8 encoding --filterfilter-nameCharacterEncodingFilter/filter-namefilter-classorg.springframework.web.filter.CharacterEncodingFilter/filter-classinit-paramparam-nameencoding/param-nameparam-valueUTF-8/param-value/init-paraminit-paramparam-nameforceEncoding/param-nameparam-valuetrue/param-value/init-param/filterfilter-mappingfilter-nameCharacterEncodingFilter/filter-nameurl-pattern/*/url-pattern/filter-mapping!-- HTTP PUT Form --filterfilter-nameHiddenHttpMethodFilter/filter-namefilter-classorg.springframework.web.filter.HiddenHttpMethodFilter/filter-class/filterfilter-mappingfilter-nameHiddenHttpMethodFilter/filter-nameurl-pattern/*/url-pattern/filter-mapping /web-app 3、SpringMvc以ResponseBody返回的时中文乱码demo学习的话可以配置下RequestMapping如下 RequestMapping(pathhome/putformBody, methodRequestMethod.PUT, produces text/plain;charsetutf-8) 五 参考连接 如何发送PUT请求和DELETE请求html 对 form 表单中 put,delete,patch的支持HTTP PUT请求时表单数据无法传递springmvc 明明到处都配置了编码为UTF-8可还是乱码
http://www.zqtcl.cn/news/492014/

相关文章:

  • 哈尔滨网站建设效果wordpress主题 手机app
  • 收录网站源码海外域名怎么打开
  • 荥阳网站建设上海十大营销策划公司
  • 在网站挂广告一个月多少钱巫溪网站建设
  • 网站备案名称的影响吗济南网站建设招聘
  • 南城区网站建设公司y2学年做的租房网站
  • 温州网站建设咨询网站源码下载后怎么布置
  • 邢台网站推广wordpress文章数据库位置
  • wordpress 快站wordpress 安装主题 主机名
  • 老网站改版启用二级域名网站建设服务是什么意思
  • 网站建设营销话术外销网站
  • 找个人给我做电影网站好主题网站开发介绍
  • 运城公司网站建设苏州网站建设苏州
  • 湖北省住房和建设厅网站首页网站用免费空间好不好
  • 网站建设公司案例做网站小图标大全
  • 美食网站主页怎么做网络营销推广的作用
  • 上海建站价格wordpress表白系统
  • 唐山 建设工程信息网站中天钢铁 网站建设
  • 公司没有备案了网站摄影素材网站
  • 正规的网店平台有哪些北京公司排名seo
  • 网页制作素材库哪个网站上海门户网站开发
  • 做网站 分辨率应该是多少做阿里巴巴网站要多少钱
  • 有专业做外贸的网站吗千岛湖网站建设
  • 百度怎么做开锁网站中国咖啡网站建设方案
  • 新网站不被收录郑州网站建设培训学校
  • 网站群建设意见征集北京做网站报价
  • 网站建设开发费会计处理山东省住房和城乡建设厅二建查询
  • 市工商局网站建设情况襄阳网站seo诊断
  • 动漫做那个视频网站单网页网站如何做
  • 企业网站名是什么意思广州公共交易中心