SpringMVC+ajax上传文件+提交表单数据报错The current request is not a multipart request

AJAX

var commercialName=$("#commercialName").val()
var commerciaPhone=$("#commerciaPhone").val()
var commerciaSite=$("#commerciaSite").val()
console.log(commercialName)
 var file=document.getElementById('file').files
var formData=new FormData()
formData.append("file",file[0])

    $.ajax({"url":"/systemController/merchantController/contact",
        "encType": 'multipart/form-data',
        "processData": false,
        "contentType":false,
        "data":{"file":formData,"commercialName":commercialName,"commerciaPhone":commerciaPhone,
            "commerciaSite":commerciaSite},
        "type":"post",
        "dataType":"json",
        "success":...
JAVA
``` @RequestMapping(value = "contact" ,method = RequestMethod.POST)
    @ResponseBody
    public Dto contact( MultipartFile file,
                       DbBusinessInformation businessInformation,
                       HttpServletRequest request)
也找了很多方法,还是没办法解决

5个回答

一般上传文件是走单独接口的,先掉上传文件接口,然后返回文件路径,然后再把文件路径名称放进form表单一起提交。望采纳

cccfire
杨园亮 回复weixin_45138850: 是的
4 个月之前 回复
weixin_45138850
weixin_45138850 意思是两个ajax吗?上传文件后再执行表单提交?
4 个月之前 回复

ajax请求时不要设置Content-Type,不需要写这一项属性

你看看 是不是springmvc没有配置dispatcher.xml文件没有配置

 <!-- 文件上传处理器  -->
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="maxUploadSize" value="20480000"/> 
    </bean>
weixin_43993558
weixin_43993558 上面也和你说了,你应该是先上传文件,在进行表单提交,后台只是接收你上传后的File文件对象还有其他的一些你要传的参数,如果单个上传没有问题,看看js和你html是否能先进入后台的controller方法
4 个月之前 回复
weixin_45138850
weixin_45138850 回复weixin_43993558: 加了,我单独上传文件没有错,但是加上表单就不行
4 个月之前 回复
weixin_43993558
weixin_43993558 property应该有默认值,我这个只是限制文件的大小(最大值),你看看相应上传文件的jar包加了吗?
4 个月之前 回复
weixin_45138850
weixin_45138850 写了 但是没有写property
4 个月之前 回复

看看js和你html是否能先进入后台的controller

weixin_45138850
weixin_45138850 进不去的,不过后来我分开上传就好了
4 个月之前 回复

你可以用表单去进行文件的上传

zea_liu
zea_liu 你说的传完返回结果吗?这个页面不会乱啊,而且你前端肯定要做一些接收了后台返回结果的处理。肯定不会乱的
4 个月之前 回复
weixin_45138850
weixin_45138850 可以是可以,但是这样子传完了页面会乱了吧
4 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
SpringMVC+ajax上传文件+提交表单数据报错The current request is not a multipart request
AJAX var commercialName=$("#commercialName").val() var commerciaPhone=$("#commerciaPhone").val() var commerciaSite=$("#commerciaSite").val() console.log(commercialName) var file=document.getElementById('file').files var formData=new FormData() formData.append("file",file[0]) $.ajax({"url":"/systemController/merchantController/contact", "encType": 'multipart/form-data', "processData": false, "contentType":false, "data":{"file":formData,"commercialName":commercialName,"commerciaPhone":commerciaPhone, "commerciaSite":commerciaSite}, "type":"post", "dataType":"json", "success":... ``` JAVA ``` @RequestMapping(value = "contact" ,method = RequestMethod.POST) @ResponseBody public Dto contact( MultipartFile file, DbBusinessInformation businessInformation, HttpServletRequest request) ``` ``` 也找了很多方法,还是没办法解决
springMVC上传文件报错404
学习springMVC文件上传的时候,选择了文件提交以后报错404 jsp ``` <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>文件上传</title> </head> <body> <h3>文件上传</h3> <form action="/User/fileUpload" method="post" enctype="multipart/form-data"> <input type="file" name="upload"><br/> <input type="submit" value="上传"> </form> </body> </html> ``` spring-MVC配置如下 ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd"> <!--开启注解扫描--> <context:component-scan base-package="com.ryn"/> <!--配置视图解析器--> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <!--配置解析器--> <property name="suffix" value=".jsp"/> <!--配置目录--> <property name="prefix" value="/WEB-INF/pages/"/> </bean> <!--配置静态资源--> <mvc:resources location="/upload/" mapping="/upload/**" /> <mvc:resources mapping="/js/**" location="js/"/> <!--配置文件解析器--> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="defaultEncoding" value="utf-8"/> <property name="maxUploadSize" value="10485760"/> </bean> <!--开启springMVC框架注解的支持--> <mvc:annotation-driven/> </beans> ``` web.xml配置 ``` <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>Archetype Created Web Application</display-name> <!--配置前端控制器--> <servlet> <servlet-name>dispatcherServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-mvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcherServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app> ``` uploadController ``` /** * 文件上传 * @return */ @RequestMapping("/fileUpload") public String fileUpload(HttpServletRequest request, @RequestParam("upload") MultipartFile upload) throws Exception{ System.out.println("文件上传"); //指定上传位置 String path = request.getSession().getServletContext().getRealPath("/upload/"); //判断文件夹是否存在 File file = new File(path); if (!file.exists()){ //若不存在,则创建文件夹 file.mkdirs(); } String filename = upload.getOriginalFilename(); //使用write方法上传文件 String uuid = UUID.randomUUID().toString().replaceAll("-", "").toUpperCase(); filename = uuid + "_" + filename; upload.transferTo(new File(path,filename)); return "success"; } ``` 报错信息如下 ![图片说明](https://img-ask.csdn.net/upload/201911/14/1573725685_322217.jpg) 求各位大佬帮我看看问题到底出在哪了!!!弄了半个小时不知道怎么回事
不使用form表单springmvc如何上传文件
项目中需要在之前哥们的代码中加上一个文件上传功能,但是之前哥们写的jsp中使用的div里嵌套的table,并没有使用form表单,提交使用的是ajax,将页面的数据转成json提交到后台的。 我如何在他的基础上将上传的文件传到后台呀?怎么接收,还是用他这个提交按钮?可以实现吗?
myeclipse中使用springMvc上传文件报错
在myeclipse中使用SpringMvc上传文件就报错,然而使用eclipse就不会 ![图片说明](https://img-ask.csdn.net/upload/201709/11/1505066912_517310.png)
ajax + springMVC 实现多文件上传
控制层使用springMVC ,普通的提交 通过 MultipartHttpServletRequest res= (MultipartHttpServletRequest)request;就可以拿到所有的附件,但是通过ajax提交后上面的代码却报错 请问ajax提交后后台怎么取得所有附件呢 ?请求指点,不胜感激!
SpringMVC跨服务器上传文件,上传至文件服务器时报404错误
这是服务器端的代码 ``` @RequestMapping("/fileupload") public String upload(MultipartFile upload) throws IOException { System.out.println("SpringMVC跨服务器方式的文件上传..."); // 定义图片服务器的请求路径 String path = "http://localhost:9090/secondly_war_exploded/uploads/"; // 获取到上传文件的名称 String filename = upload.getOriginalFilename(); // 向图片服务器上传文件 // 创建客户端对象 Client client = Client.create(); // 连接图片服务器 WebResource webResource = client.resource(path+filename); // 上传文件 webResource.put(upload.getBytes()); return "success"; } ``` 这是报错的信息: ![图片说明](https://img-ask.csdn.net/upload/201910/05/1570271504_300400.png) 报错的核心信息是上传到图片服务器的时候404错误。 起初我以为是我的路径写的有问题或者服务器没开,然后我将路径直接粘贴到地址栏上,并没有任何问题: ![图片说明](https://img-ask.csdn.net/upload/201910/05/1570271649_380764.png) 本人在网上找了许久,也不见符合的相关答案
springMVC上传文件报错
09:13:59,716 ERROR [RequestUtils] Caught error while decoding priorityId. org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing o f multipart/form-data request failed. Stream ended unexpectedly at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:163) at org.springframework.web.multipart.commons.CommonsMultipartResolver$1.initializeMultipart(CommonsMultipartResolver.java:131) at org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest.getMultipartParameters(DefaultMultipartHttpServletRequest.java:163) at org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest.getParameter(DefaultMultipartHttpServletRequest.java:80) at com.gsol.enigma.web.util.RequestUtils.isLoggedInUniversal(RequestUtils.java:1310) at com.gsol.enigma.web.util.RequestUtils.isLoggedIn(RequestUtils.java:1253) at com.gsol.enigma.web.util.RequestUtils.getUser(RequestUtils.java:1058) at com.gsol.cuckoo.util.common.RequestUtil.getUserLocale(RequestUtil.java:64) at com.gsol.cuckoo.util.interceptor.I18nInterceptor.preHandle(I18nInterceptor.java:63) at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:130) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:913) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.gsol.cuckoo.filter.LoginFilter.doFilter(LoginFilter.java:100) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:115) at org.sitemesh.config.ConfigurableSiteMeshFilter.doFilter(ConfigurableSiteMeshFilter.java:163) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) at java.lang.Thread.run(Thread.java:722) Caused by: org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:351) at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:115) at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:156) ... 42 more Caused by: org.apache.commons.fileupload.MultipartStream$MalformedStreamException: Stream ended unexpectedly at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:1005) at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:903) at java.io.InputStream.read(InputStream.java:101) at org.apache.commons.fileupload.util.Streams.copy(Streams.java:100) at org.apache.commons.fileupload.util.Streams.copy(Streams.java:70) at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:347) ... 44 more
myeclipse SpringMVC配置文件标签“context:component-scan”报错。
框架使用的是maven+springmvc,配置文件标签“context:component-scan”报错,不影响运行。错误如下: ![图片说明](https://img-ask.csdn.net/upload/201911/25/1574656349_538083.jpg) ![图片说明](https://img-ask.csdn.net/upload/201911/25/1574656376_439969.jpg) 以下是项目结构: ![图片说明](https://img-ask.csdn.net/upload/201911/25/1574656442_860333.jpg) 请问是我配置有问题还是myeclipse检查错误。有什么办法能解决这个错误,或者屏蔽这个错误。我基本尝试了网上的各种方法,只要项目clean了这个错误就会重新出现。
Springmvc+jsp项目,使用ajax得到图片地址
Springmvc+jsp项目,使用ajax得到图片地址并显示,使用的动态拼接字符串,将图片标签加入页面,结果只能显示一张图片,其他的都显示nohandlerfound
通过表单提交到springmvc报错403
通过freemarker跳转到springmvc某个controller,如果是get方式则没什么问题。如果是post,这里表单制定的是post方式,controller制定的也是post,但是跳转不过去。并且报403错误 “HTTP Status 403 - Bad or missing token!”。求大神帮忙解决。感谢
SpringMVC + ajax 上传文件不成功,用submit上传能实现
![图片说明](https://img-ask.csdn.net/upload/201905/24/1558628134_860325.png)
Springmvc上传文件限制大小,异常处理返回报错信息后,eclipse控制台还报错
**1、web.xml配置:** ``` <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <!-- 注册主控制器DispatcherServlet --> <servlet> <servlet-name>DispatcherServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <!-- 指定spring配置文件位置 --> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>DispatcherServlet</servlet-name> <url-pattern>*.from</url-pattern> </servlet-mapping> <!-- 指定读取所有文件的编码格式 --> <filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app> ``` **spring的applicationContext.xml配置:** ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"> <!-- 定义自动扫描组件 --> <context:component-scan base-package="controller"></context:component-scan> <!-- 定义@RequestMapping映射的注解驱动 --> <mvc:annotation-driven></mvc:annotation-driven> <!-- 定义视图解析器 --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix"> <value>/WEB-INF/jsp/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> <!-- 注册spring web mvc中处理上传事件的组件CommonsMultipartResolver, 而具体怎样处理上传文件,则是由导入的包common-upload.jar和common-io.jar去处理--> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize" value="10240"></property> <property name="resolveLazily" value="true"></property> </bean> </beans> ``` **java代码Controller处理:** ``` package controller; import java.io.File; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MaxUploadSizeExceededException; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; @Controller public class UploadController { // 访问upload.jsp页面 @RequestMapping("/toUpload") public String toUpload() { return "upload"; } @RequestMapping("/upload") public String upload(@RequestParam("file") MultipartFile file, HttpServletRequest request, ModelMap model) throws Exception { // 判断提交来的文件是否为空 if (file.isEmpty()) { // model.addAttribute("error", "上传文件不能为空"); // return "upload"; throw new RuntimeException("file is null"); } // 获取文件所要保存目录在服务器上所对应的实际路径 String path = request.getSession().getServletContext().getRealPath( "upload"); System.out.println(path); // 组成拥有真实路径的一个完整的地址字符串 String fileUrl = path + "\\" + file.getOriginalFilename(); // 封装上传文件名称到model对象中 model.addAttribute("fileName", file.getOriginalFilename()); // 根据这个完整地址字符串,生成提交文件所要保存到的目标文件或目录的对象 File targetFile = new File(fileUrl); // 判断目标文件或目录的对象是否已经存在 if (!targetFile.exists()) { targetFile.mkdirs(); } // 传送文件到目标对象 file.transferTo(targetFile); System.out.println("已上传文件:" + file); return "ok"; } @ExceptionHandler public ModelAndView doException(Exception e,HttpServletRequest request) throws Exception { Map<String,Object> map = new HashMap<String,Object>(); if (e instanceof MaxUploadSizeExceededException) { long maxSize = ((MaxUploadSizeExceededException) e) .getMaxUploadSize(); map.put("error", "上传文件太大,不能超过" + maxSize / 1024 + "k"); }else if(e instanceof RuntimeException){ map.put("error", "未选中文件"); }else{ map.put("error", "上传失败"); } return new ModelAndView("upload",map); } } ``` **上传文件页面upload.jsp:** ``` <%@ page pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>上传页面</title> </head> <body> <form action="upload.from" method="post" enctype="multipart/form-data"> <input type="file" name="file"/> <input type="submit" value="上传"/><font color="red">${error}</font> </form> </body> </html> ``` **上传成功页面ok.jsp:** ``` <%@ page pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>ok.jsp</title> </head> <body> <h1>上传成功</h1> <a href="upload/${fileName}">${fileName}</a> </body> </html> ``` **eclipse控制台报错信息如下:** ``` 五月 01, 2015 10:27:01 下午 org.springframework.web.multipart.commons.CommonsMultipartResolver cleanupMultipart 警告: Failed to perform multipart cleanup for servlet request org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size of 10240 bytes exceeded; nested exception is org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (19243) exceeds the configured maximum (10240) at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:160) at org.springframework.web.multipart.commons.CommonsMultipartResolver$1.initializeMultipart(CommonsMultipartResolver.java:131) at org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest.getMultipartFiles(AbstractMultipartHttpServletRequest.java:119) at org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest.getMultiFileMap(AbstractMultipartHttpServletRequest.java:99) at org.springframework.web.multipart.commons.CommonsMultipartResolver.cleanupMultipart(CommonsMultipartResolver.java:188) at org.springframework.web.servlet.DispatcherServlet.cleanupMultipart(DispatcherServlet.java:1062) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:955) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855) at javax.servlet.http.HttpServlet.service(HttpServlet.java:650) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2476) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2465) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (19243) exceeds the configured maximum (10240) at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:914) at org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331) at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:349) at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126) at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:156) ... 37 more ``` 上传文件超过限制大小,异常处理后页面返回了提示信息“上传文件太大,不能超过10k”,但是为啥eclipse的控制台还是有报错呢?
springmvc怎么获取前端(jsp)文件的数据
前端有一个文本框和一个按钮,在文本框输入内容后,点击提交,怎么把数据传到后台(springmvc),且此时页面不会跳转? +++++++++++++++++++++++++++ 前端 ``` <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Title</title> </head> <body> <form> <input type="text" name="name" id="word" placeholder="请输入内容"> <button id="btn" type="submit"></button> </form> </body> </html> ``` 后台: 不知道要用什么(ModelAndView、Model、session)? +++++++++++++++++++ 请大神指教,谢谢
springmvc实现上传文件进度条数值显示错乱
最近做了一个文件上传进度条显示的功能,框架是基于springmvc的。 参考:http://my.oschina.net/xiaotian120/blog/198225 做的 ![图片说明](https://img-ask.csdn.net/upload/201606/21/1466478269_320000.png) ps:目前这边是服务端计算了上传进度之后,存入到session中,页面定时取这个session中的值,从而进行进度条展示的。 因为进度条的数值是存到session中的,那么 这样做的话,有两个问题,不知道怎么解决 问题一(急!!!): 同一个浏览器的不同标签页进行文件上传,那么上传文件的进度条数值会乱串,不知道该怎么解决。 问题二: 同一个浏览器的同一个标签页有两个上传文件的按钮,两个文件同时上传文件,那么上传的进度条数值会相互串,不知道有什么好的解决方式?(目前我就简单的js控制,让用户一次只能上传一个文件)
springMvc 返回json数据报错!
环境:springMvc5.1.8 jackson-databind2.9.9 ``` @Controller public class EmployeeController { @Autowired private EmployeeService employeeService; @RequestMapping(value = "/emps") @ResponseBody public List<Employee> findUser(@RequestParam(defaultValue = "1", name = "pageNum") Integer pageNum){ List<Employee> empsList = employeeService.selectAllEmployee(); return empsList; } } ``` 当我发送请求时报错: No converter found for return value of type: class java.util.ArrayList。 通过百度,找到解决方法,在applicationContext.xml中添加如下内容: ``` <mvc:annotation-driven> <mvc:message-converters> <bean class="org.springframework.http.converter.StringHttpMessageConverter"/> <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/> </mvc:message-converters> </mvc:annotation-driven> ``` 这次报了另外一个错误,如下: ``` org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Cannot create inner bean 'org.springframework.http.converter.json.MappingJackson2HttpMessageConverter#0' of type [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter] while setting bean property 'messageConverters' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.http.converter.json.MappingJackson2HttpMessageConverter#0': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter] from ClassLoader [ParallelWebappClassLoader context: WebDome delegate: false ----------> Parent Classloader: java.net.URLClassLoader@156643d4 ] org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:361) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:399) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:159) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1681) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1433) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845) org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:701) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:667) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:715) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:590) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:529) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:169) javax.servlet.GenericServlet.init(GenericServlet.java:158) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:748) Root Cause org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.http.converter.json.MappingJackson2HttpMessageConverter#0': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter] from ClassLoader [ParallelWebappClassLoader context: WebDome delegate: false ----------> Parent Classloader: java.net.URLClassLoader@156643d4 ] org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:265) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1269) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1184) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:346) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:399) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:159) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1681) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1433) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845) org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:701) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:667) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:715) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:590) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:529) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:169) javax.servlet.GenericServlet.init(GenericServlet.java:158) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:748) Root Cause java.lang.IllegalStateException: Failed to introspect Class [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter] from ClassLoader [ParallelWebappClassLoader context: WebDome delegate: false ----------> Parent Classloader: java.net.URLClassLoader@156643d4 ] org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:507) org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:404) org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:389) org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:248) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1269) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1184) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:346) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:399) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:159) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1681) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1433) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845) org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:701) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:667) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:715) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:590) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:529) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:169) javax.servlet.GenericServlet.init(GenericServlet.java:158) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:748) Root Cause java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/util/DefaultPrettyPrinter$Indenter java.lang.Class.getDeclaredMethods0(Native Method) java.lang.Class.privateGetDeclaredMethods(Class.java:2701) java.lang.Class.getDeclaredMethods(Class.java:1975) org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:489) org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:404) org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:389) org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:248) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1269) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1184) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:346) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:399) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:159) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1681) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1433) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845) org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:701) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:667) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:715) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:590) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:529) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:169) javax.servlet.GenericServlet.init(GenericServlet.java:158) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:748) Root Cause java.lang.ClassNotFoundException: com.fasterxml.jackson.core.util.DefaultPrettyPrinter$Indenter org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365) org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188) java.lang.Class.getDeclaredMethods0(Native Method) java.lang.Class.privateGetDeclaredMethods(Class.java:2701) java.lang.Class.getDeclaredMethods(Class.java:1975) org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:489) org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:404) org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:389) org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:248) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1269) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1184) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:346) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:399) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:159) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1681) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1433) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845) org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:701) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:667) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:715) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:590) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:529) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:169) javax.servlet.GenericServlet.init(GenericServlet.java:158) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:748) ``` 求大神帮帮忙呀!卡在这一天了!
springmvc表单以对象方式提交获取
当添加除或者修改数据太多时 可不可以把表单数据当成对象来提交 用springmvc和mybatis
springmvc ajax json
刚开始学ajax。。。导入的jar包:jackson-mapper-asl-1.8.8.jar 和 jackson-core-asl-1.8.8.jar jsp代码 ``` <head> <script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.9.1.js"></script> <script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.9.1.min.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf8"> <title>Insert title here</title> <script type="text/javascript"> function ajaxTest(){ $.ajax({ data:"name="+$("#name").val(), //参数 type:"GET", dataType: 'json', //响应数据类型 url:"${pageContext.request.contextPath}/login/ajax.html", dataFilter:function(data,type) {console.log(data); console.log(type); }, error:function(data){ alert("出错了!!:"+data.msg); console.log(arguments); }, success:function(data){ alert("success:"+data.msg); $("#result").html(data.msg) ; console.log(arguments); } }); } </script> </head> <body> <input type="text" name="name" id="name"/> <input type="submit" value="登录" onclick="ajaxTest();"/> <div id="result"></div> </body> ``` controller代码: ``` @RequestMapping(value="ajax",method=RequestMethod.GET) public @ResponseBody Map<String,Object> login(HttpServletRequest request,HttpServletResponse response) throws IOException{ System.out.println(request.getParameter("name")); Map<String,Object> map = new HashMap<String,Object>(); if(request.getParameter("name").equals("123")){ System.out.println("成功"); map.put("msg", "成功"); }else{ System.out.println("失败"); map.put("msg", "失败"); } return map; } ``` 出现的错误 ![图片说明](https://img-ask.csdn.net/upload/201511/04/1446625783_473960.png) ![图片说明](https://img-ask.csdn.net/upload/201511/04/1446625795_726463.png) ![图片说明](https://img-ask.csdn.net/upload/201511/04/1446625803_56744.png) ![图片说明](https://img-ask.csdn.net/upload/201511/04/1446626003_354347.png)
用springMVC框架做文件上传时遇到问题
我是基于red5服务器。来用springMVC框架做文件上传。在上传文件时遇到错误。 @RequestMapping(value = "/upload.do",method = RequestMethod.POST) public String upload(HttpServletRequest request, HttpServletResponse response, String string) { System.out.println("==================run in import"); System.out.println("--------------" + request.getParameter("upload")); // 创建一个通用的多部分解析器. CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver( request.getSession().getServletContext()); // 设置编码 commonsMultipartResolver.setDefaultEncoding("utf-8"); System.out.println("++++++commonsMultipartResolver.isMultipart(request) : " + commonsMultipartResolver.isMultipart(request)); // 判断是否有文件上传 if (commonsMultipartResolver.isMultipart(request)) { MultipartHttpServletRequest multipartRequest = commonsMultipartResolver .resolveMultipart(request); Iterator<String> iter = multipartRequest.getFileNames(); System.out.println("+++++++++++iter = "+iter.toString()); // iter里面没有值 while (iter.hasNext()) { MultipartFile file = multipartRequest.getFile((String) iter.next()); if (file != null) { File localFile = new File("/WEB-INF/upload" + file.getOriginalFilename()); try { // file.transferTo(localFile); System.out.println("=======1111111111111===="); file.transferTo(localFile); System.out.println("====222222222222222======="); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } // 批量上传 // Map<String, MultipartFile> fileMap = request.getFileMap(); // for(Entry<String, MultipartFile> entry : fileMap.entrySet()){ // MultipartFile file = entry.getValue(); // try { // file.transferTo(new File("/WEB-INF/upload" + // file.getOriginalFilename())); // } catch(IllegalStateException e){ // e.printStackTrace(); // }catch (Exception e) { // // TODO: handle exception // e.printStackTrace(); // } // } return "up"; } } 上传文件后,在我指定的地方没有找到文件。测试发现 if (commonsMultipartResolver.isMultipart(request)) 这个地方获得的是false,我这个action没有接收到上传的文件,但是通过System.out.println("--------------" + request.getParameter("upload"));获取到了我上传文件的文件名。 通过上网查找,我在配置文件中配置了MultipartResolver处理器 <!-- SpringMVC上传文件时,需要配置MultipartResolver处理器 --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <!-- 指定所上传文件的总大小不能超过200KB。注意maxUploadSize属性的限制不是针对单个文件,而是所有文件的容量之和 --> <property name="maxUploadSize" value="200000"/> </bean> <!-- SpringMVC在超出上传文件限制时,会抛出org.springframework.web.multipart.MaxUploadSizeExceededException --> <!-- 该异常是SpringMVC在检查上传的文件信息时抛出来的,而且此时还没有进入到Controller方法中 --> <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="exceptionMappings"> <props> <!-- 遇到MaxUploadSizeExceededException异常时,自动跳转到/WEB-INF/jsp/error_fileupload.jsp页面 --> <prop key="org.springframework.web.multipart.MaxUploadSizeExceededException">error_fileupload</prop> </props> </property> </bean> 如果我在代码最上面写 MultipartHttpServletRequest rrr = (MultipartHttpServletRequest) request; 他就会报转化错误 java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade cannot be cast to org.springframework.web.multipart.MultipartHttpServletRequest 不知道现在是什么问题,求解啊!
SpringMVC 能用表单提交查询条件 可以获得返回的值 并显示 ,但是用Ajax就不行了 ,为什么??
1. SpringMVC 能用表单提交查询条件 可以获得返回的值 并显示 ,但是用Ajax就不行了 ,为什么?? ``` # 后台 @ResponseBody @RequestMapping(value = "/getstockprice") public ModelAndView selectStockPriceByID() { ModelAndView mv = this.getModelAndView(); PageData pd = new PageData(); boolean result = false; double stockPrice = 0; try { pd = this.getPageData(); String stockNum = (String) pd.get("stockNum"); stockPrice = (double) this.lxwstockexchangefacade.selectStockPriceByID(stockNum).get("StockPrice"); result=true; } catch (Exception e) { logger.error(e); e.printStackTrace(); } mv.addObject("result", result); mv.addObject("stockPrice", stockPrice); mv.setViewName("lxw/ExchangeDistrict"); return mv; } # Ajax <script type="text/javascript"> $(function(){ alert("查询信息"); var para ={userName:'lxl',stockNum:'000725'}; var url = root + "/lxwempAjax/lxwOptionalStock"; $.ajax({ type:"POST", url:url, data:para, datatype:'json', success:function(result){ alert('提交成功'+para.stockNum+para.userName); }, error:function(result){ alert('提交失败'+para.stockNum+para.userName); } }); alert('${res.get(0).get("StockName")}'); alert("执行完成"); }) </script> # ```表单 ![图片说明](https://img-ask.csdn.net/upload/201905/10/1557420188_781229.png) ```
ajax文件上传,springMVC报空指针异常
我使用的是ajaxfileupload.js,调试了半天,崩溃了,使用form的submit提交时没有问题的,可是无法实现异步刷新,求大神指点!!!
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
Vue + Spring Boot 项目实战(十四):用户认证方案与完善的访问拦截
本篇文章主要讲解 token、session 等用户认证方案的区别并分析常见误区,以及如何通过前后端的配合实现完善的访问拦截,为下一步权限控制的实现打下基础。
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
漫话:什么是平衡(AVL)树?这应该是把AVL树讲的最好的文章了
这篇文章通过对话的形式,由浅入深带你读懂 AVL 树,看完让你保证理解 AVL 树的各种操作,如果觉得不错,别吝啬你的赞哦。 1、若它的左子树不为空,则左子树上所有的节点值都小于它的根节点值。 2、若它的右子树不为空,则右子树上所有的节点值均大于它的根节点值。 3、它的左右子树也分别可以充当为二叉查找树。 例如: 例如,我现在想要查找数值为14的节点。由于二叉查找树的特性,我们可...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
开源并不是你认为的那些事
点击上方蓝字 关注我们开源之道导读所以 ————想要理清开源是什么?先要厘清开源不是什么,名正言顺是句中国的古代成语,概念本身的理解非常之重要。大部分生物多样性的起源,...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员...
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC...
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下...
《C++ Primer》学习笔记(六):C++模块设计——函数
专栏C++学习笔记 《C++ Primer》学习笔记/习题答案 总目录 https://blog.csdn.net/TeFuirnever/article/details/100700212 —————————————————————————————————————————————————————— 《C++ Primer》习题参考答案:第6章 - C++模块设计——函数 文章目录专栏C+...
8年经验面试官详解 Java 面试秘诀
作者 |胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。 Java程序员准备和投递简历的实...
面试官如何考察你的思维方式?
1.两种思维方式在求职面试中,经常会考察这种问题:北京有多少量特斯拉汽车?某胡同口的煎饼摊一年能卖出多少个煎饼?深圳有多少个产品经理?一辆公交车里能装下多少个乒乓球?一个正常成年人有多少根头发?这类估算问题,被称为费米问题,是以科学家费米命名的。为什么面试会问这种问题呢?这类问题能把两类人清楚地区分出来。一类是具有文科思维的人,擅长赞叹和模糊想象,它主要依靠的是人的第一反应和直觉,比如小孩...
so easy! 10行代码写个"狗屁不通"文章生成器
前几天,GitHub 有个开源项目特别火,只要输入标题就可以生成一篇长长的文章。 背后实现代码一定很复杂吧,里面一定有很多高深莫测的机器学习等复杂算法 不过,当我看了源代码之后 这程序不到50行 尽管我有多年的Python经验,但我竟然一时也没有看懂 当然啦,原作者也说了,这个代码也是在无聊中诞生的,平时撸码是不写中文变量名的, 中文...
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的回答,对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalking,作者吴晟、刘浩杨 等等 仓库地址: apache/skywalking 更...
相关热词 c# 图片上传 c# gdi 占用内存 c#中遍历字典 c#控制台模拟dos c# 斜率 最小二乘法 c#进程延迟 c# mysql完整项目 c# grid 总行数 c# web浏览器插件 c# xml 生成xsd
立即提问