java.lang.NumberFormatException: Invalid int: ""

07-08 10:18:40.743: W/System.err(32269): java.lang.NumberFormatException: Invalid int: ""

07-08 10:18:40.763: W/System.err(32269): at java.lang.Integer.invalidInt(Integer.java:138)

07-08 10:18:40.763: W/System.err(32269): at java.lang.Integer.parseInt(Integer.java:359)

07-08 10:18:40.763: W/System.err(32269): at java.lang.Integer.parseInt(Integer.java:332)

07-08 10:18:40.763: W/System.err(32269): at java.util.Calendar.getHwFirstDayOfWeek(Calendar.java:807)

07-08 10:18:40.763: W/System.err(32269): at java.util.Calendar.(Calendar.java:745)

07-08 10:18:40.763: W/System.err(32269): at java.util.GregorianCalendar.(GregorianCalendar.java:338)

07-08 10:18:40.763: W/System.err(32269): at java.util.GregorianCalendar.(GregorianCalendar.java:314)

07-08 10:18:40.763: W/System.err(32269): at java.text.SimpleDateFormat.(SimpleDateFormat.java:378)

07-08 10:18:40.763: W/System.err(32269): at java.text.SimpleDateFormat.(SimpleDateFormat.java:368)

07-08 10:18:40.763: W/System.err(32269): at libcore.net.http.HttpDate$1.initialValue(HttpDate.java:38)

07-08 10:18:40.763: W/System.err(32269): at libcore.net.http.HttpDate$1.initialValue(HttpDate.java:36)

07-08 10:18:40.763: W/System.err(32269): at java.lang.ThreadLocal$Values.getAfterMiss(ThreadLocal.java:430)

07-08 10:18:40.763: W/System.err(32269): at java.lang.ThreadLocal.get(ThreadLocal.java:65)

07-08 10:18:40.763: W/System.err(32269): at libcore.net.http.HttpDate.parse(HttpDate.java:73)

07-08 10:18:40.773: W/System.err(32269): at libcore.net.http.ResponseHeaders.(ResponseHeaders.java:142)

07-08 10:18:40.773: W/System.err(32269): at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:547)

07-08 10:18:40.773: W/System.err(32269): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:784)

07-08 10:18:40.773: W/System.err(32269): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274)

07-08 10:18:40.773: W/System.err(32269): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:479)

07-08 10:18:40.773: W/System.err(32269): at com.example.uploadtest.UploadARMThread.post(UploadARMThread.java:132)

07-08 10:18:40.773: W/System.err(32269): at com.example.uploadtest.UploadARMThread.run(UploadARMThread.java:34)

以上错误发生在
int code = urlConn.getResponseCode();这一句

HttpURLConnection urlConn = null;
BufferedReader br = null;
try {
//新建url对象
URL url = new URL(actionUrl);
//通过HttpURLConnection对象,向网络地址发送请求
urlConn = (HttpURLConnection)url.openConnection();

        //设置该连接允许读取
        urlConn.setDoOutput(true);   
        //设置该连接允许写入
        urlConn.setDoInput(true);   
        //设置不能适用缓存
        urlConn.setUseCaches(false);
        //设置连接超时时间
        urlConn.setConnectTimeout(3000);   //设置连接超时时间
        //设置读取时间
        urlConn.setReadTimeout(4000);   //读取超时
        //设置连接方法post
        urlConn.setRequestMethod("POST");
        //设置维持长连接
        urlConn.setRequestProperty("connection", "Keep-Alive");
        //设置文件字符集
        urlConn.setRequestProperty("Charset", CHARSET);
        //设置文件类型
        urlConn.setRequestProperty("Content-Type", MUTIPART_FORMDATA+";boundary="+BOUNDARY);
        /********************************************************************/      
        DataOutputStream dos = new DataOutputStream(urlConn.getOutputStream());

        //构建表单数据
        //String entryText = bulidFormText(params);
        //dos.write(entryText.getBytes());

        int index = 1;


            StringBuffer sb = new StringBuffer("");
            sb.append(PREFIX+BOUNDARY+LINEND)                
            .append("Content-Disposition: form-data;" +
                " name=\""+"123456"+"\";" +
                " filename=\""+"2222222"+"\""+LINEND)
                .append("Content-Type:"+CONTENTTYPE+";" +
                        "charset="+CHARSET+LINEND)
                  .append(LINEND);

            dos.write(sb.toString().getBytes());

            FileInputStream fis = new FileInputStream(files);

            byte[] buffer = new byte[10000];
              int len = 0;
              while ((len = fis.read(buffer)) != -1) {
                dos.write(buffer, 0, len);
              }
              dos.write(LINEND.getBytes());
              fis.close();


        //请求的结束标志
        byte[] end_data = (PREFIX + BOUNDARY + PREFIX + LINEND).getBytes();
        dos.write(end_data);
        dos.flush();
        dos.close();
        // 发送请求数据结束  

        //接收返回信息    
        int code = urlConn.getResponseCode();
        if(code!=200){
            urlConn.disconnect();
            return code;
        }else{
            br = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
            String result = "";
            String line = null;
            while((line = br.readLine())!=null){
                result += line;
            }
            Log.i(Constant.TAG, result);
            if("true".equals(result)){
                return 200;
            }else{
                return 500;
            }
        }
    } catch (Exception e) {
      e.printStackTrace();
      Log.e(Constant.TAG, e.getMessage());
      return -1;
    }finally{
      try {
        if(br!=null){
          br.close();
        }
        if(urlConn!=null){
          urlConn.disconnect();
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    这段代码在一个Thread的Run()中执行, 不在主进程

3个回答

java.lang.NumberFormatException: Invalid int: “”

http://stackoverflow.com/questions/24910757/java-lang-numberformatexception-invalid-int-null

错误代码

hostText = (EditText) findViewById(R.id.host);
p......
答案就在这里:java.lang.NumberFormatException: Invalid int: ""
----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。

转换出错了,你的值不能被转换为int,看看数据源的数据是否正常

mchp
mchp 你好, 我是要上传文件, 要上传的文件没问题, 就是打开连接上传时, 出这个错, 我都很奇怪, 这和格式转换没有关系呀
接近 4 年之前 回复

你把 “”空串转int,肯定不行的啊

mchp
mchp 我是要上传文件, 要上传的文件没问题, 就是打开连接上传时, 出这个错, 我都很奇怪, 我没有进行格式转换
接近 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
使用dbcp连接数据库报错java.lang.NumberFormatException: For input string: "20 "?

内容: 换了一个工程就可以跑得动 报错: ``` java.lang.NumberFormatException: For input string: "20 " at java.base/java.lang.NumberFormatException.forInputString(Unknown Source) at java.base/java.lang.Integer.parseInt(Unknown Source) at java.base/java.lang.Integer.parseInt(Unknown Source) at org.apache.commons.dbcp.BasicDataSourceFactory.createDataSource(BasicDataSourceFactory.java:228) at com.ekihin.part01.day20.DBCPDemo.<clinit>(DBCPDemo.java:21) at com.ekihin.part01.day20.DBCPDemoTest.main(DBCPDemoTest.java:15) Exception in thread "main" java.lang.NullPointerException at com.ekihin.part01.day20.DBCPDemo.getConnection(DBCPDemo.java:29) at com.ekihin.part01.day20.DBCPDemoTest.main(DBCPDemoTest.java:15) ``` 类: ``` import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class DBCPDemoTest { public static void main(String[] args) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; String sql = "Update emp set ename = ? where ename = ? "; conn = DBCPDemo.getConnection(); ps = conn.prepareStatement(sql); ps.setObject(1, "彭奕滨"); ps.setObject(2, "ekihin"); int rows = 0; rows = ps.executeUpdate(); System.out.println(rows); DBCPDemo.closeAll(conn, ps, rs); } } ``` ``` import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; import javax.sql.DataSource; import org.apache.commons.dbcp.BasicDataSourceFactory; public class DBCPDemo { private static DataSource ds = null; static { Properties pt = new Properties(); try { pt.load(DBCPDemo.class.getClassLoader().getResourceAsStream("dbcpconfig.properties")); ds = BasicDataSourceFactory.createDataSource(pt); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static Connection getConnection() throws SQLException{ //返回一个连接对象,不要用DriverManager获取,而是连接池中获取 return ds.getConnection(); } //关闭所有资源的统一代码 public static void closeAll(Connection conn,Statement st,ResultSet rs){ //负责关闭 if(conn != null){ try { conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if(st != null){ try { st.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if(rs != null){ try { rs.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } ```

java.lang.NumberFormatException:

刚注册没分 担待啊 这两段代码问题 int firstcount=(Integer.valueOf(currentpage)-1)*Integer.valueOf(recordpage); int lastcount=Integer.valueOf(recordpage); 严重: Servlet.service() for servlet [BasesAction] in context with path [/sss] threw exception java.lang.NumberFormatException: For input string: "0 " at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.valueOf(Integer.java:582) at www.action.BasesAction.doGet(BasesAction.java:76) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:163) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:556) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:401) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:242) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:267) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:245) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:260) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722)

严重: [java.lang.NumberFormatException: null]

求助,在学习jsp中遇到这个问题,望大神帮助。 这是我的代码: <body> <% int id = Integer.parseInt(request.getParameter("id")); String dbDriver = "com.mysql.jdbc.Driver"; String dbUrl = "jdbc:mysql://localhost:3306/jsp"; String dbUser = "root"; String dbPass = "root"; Class.forName(dbDriver); Connection conn=DriverManager.getConnection(dbUrl, dbUser, dbPass); String sql="select * from admin where id="+id; Statement stmt=conn.createStatement(); ResultSet rs=stmt.executeQuery(sql); if(rs.next()){ %> <form action="do_update.jsp? id=<%=rs.getInt("id") %>" method="post"> <input type="text" name="username" value=<%=rs.getString("username") %>><br> <input type="text" name="password" value=<%=rs.getString("password") %>><br> <input type="submit" value="更新"> </form> <% } %> </body> 报错: 严重: Servlet.service() for servlet [jsp] in context with path [/hello5] threw exception [java.lang.NumberFormatException: null] with root cause java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Integer.java:454) at java.lang.Integer.parseInt(Integer.java:527) at org.apache.jsp.do_005fupdate_jsp._jspService(do_005fupdate_jsp.java:98) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) 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.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:503) 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:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) 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:744)

String转化为Double时出现java.lang.NumberFormatException: For input string: "3.0E"

String text = "3.0E0" 怎样将它转换为Double d = 3.0,用Double.valueOf(text);就出现java.lang.NumberFormatException: For input string: "3.0E"的错误,因为E不是数字,怎样解决这个问题? [b]问题补充:[/b] 谢谢各位的回答,如果text = "3.0E0" 是没有问题的,我搞错了。其实出错是因为text = "3.0E",因为我是根据用户的输入给text赋值,结果用户输入到3.0E时就报错了,贴代码: text_2.addModifyListener(new ModifyListener(){ @Override public void modifyText(ModifyEvent e) { // TODO Auto-generated method stub for(int i=0;i<table.getSelectionCount();i++){ tableItem[i].setText(3,text_2.getText()); if(text_2.getText()!=""){ selectedParameter[i].setUpper (Double.parseDouble(text_2.getText()));//这里出错 } } } });

java.lang.NumberFormatException: null

at java.lang.Integer.parseInt(Integer.java:542) at java.lang.Integer.valueOf(Integer.java:766) at www.pengzheng.web.LoginServlet.service(LoginServlet.java:33) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) 代码: request.setCharacterEncoding("Utf-8"); response.setContentType("text/html;charset=utf-8"); PrintWriter out=response.getWriter(); Integer empno=Integer.valueOf(request.getParameter("name")); out.println(empno); EmpDao dao=new EmpDaoImpl(); Emp emp=dao.queryEmpByNo(empno.intValue()); if(empno.toString()==""||empno==null){ out.print("empno为空"); request.setAttribute("error", "用户编号不存在"); request.getRequestDispatcher("login.jsp").forward(request, response); } if(emp!=null){ request.setAttribute("empno", empno); response.sendRedirect("ok.jsp"); jsp代码: <form method="get" action="login"> <input type="text" name="empname" /><span>${error!=null?error:""}</span><br/> <input type="submit" value="登录"/> </form>

nested exception is java.lang.NumberFormatException:

rg.springframework.validation.BeanPropertyBindingResult: 1 errors********** *efault message [Failed to convert property value of type 'java.lang.String' to required typorg.springframework.validation.BeanPropertyBindingResult: 1 errors efault message [Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Integer' for property 'rentroomtype1'; nested exception is java.lang.NumberFormatException: For input string: "主?"] ## ## 代码: //添加一条数据 function addLea(){ //addImg(); //alert("test"); var renttitle1 =$("#renttitle1").val(); var rentarea1 = $("#rentarea1").val(); var areadetail1 = $("#areadetail1").val(); var rentroomType1 = $("#rentroomtype1").val(); var rentroomtype1; if(rentroomType1==0){ rentroomtype1 = "整租"; }else if(rentroomType1 == 1){ rentroomtype1 = "主卧"; }else if(rentroomType1 == 2){ rentroomtype1 = "次卧"; } var rentprize1 = $("#rentprize1").val(); var genderRequire1 = $("#genderrequire1").val(); var genderrequire1; if(genderRequire1==0){ genderrequire1 = "不限男女"; }else if(genderRequire1 == 1){ genderrequire1 = "男"; }else if(genderRequire1 == 2){ genderrequire1 = "女"; } var rentstartdate1 = $("#rentstartdate1").val(); var rentenddate1 = $("#rentenddate1").val(); var formData = new FormData(); for (var i=0;i<$('#roompictureurl1')[0].files.length;i++){ formData.append('file',$('#roompictureurl1')[0].files[i]); } /* console.log(formData.getAll('file')); */ formData.append('renttitle1',renttitle1); formData.append('rentpublisher1',1004); formData.append('rentarea1',rentarea1); formData.append('areadetail1',areadetail1); formData.append('rentroomtype1',rentroomtype1.toString()); formData.append('rentprize1',rentprize1); formData.append('genderRequire1',genderRequire1.toString()); formData.append('rentstartdate1',rentstartdate1); formData.append('rentenddate1',rentenddate1); /* var roompictureurl1 =$("#roompictureurl1").val(); */ $.ajax({ url: '<%=request.getContextPath()%>/insertOne.do', type: 'post', data: formData, dataType:'json', cache: false, processData: false, contentType: false, success : function(data) { $('#myModal').modal('hide'); $('#back').hide(); $('#sure').hide(); $("#showContent").text('添加成功!'); setTimeout(function () {$('#delModal').modal('show');}, 500); setTimeout(function () {$("#delModal").modal('hide');}, 1500); setTimeout(function () {window.location.reload(); },2000); //alert(formData); //window.location.reload(); } }) } 点击提交的时候报上面的错

java.lang.NumberFormatException: For input string

直接在浏览器访问tolist.do,这是一个列出数据库帖子的请求,测试可以查询获取到pList中,但是执行controller中的model.addAttribute("pList", pList);这句就会报错,注释掉就没有报错。 求大神解答,万分感谢!!! 报错信息: ![图片说明](https://img-ask.csdn.net/upload/201707/17/1500298791_20553.png) 还有debug信息: ``` DEBUG [http-bio-8080-exec-3] - Rendering view [org.springframework.web.servlet.view.InternalResourceView: unnamed; URL [index.jsp]] in DispatcherServlet with name 'springmvc' DEBUG [http-bio-8080-exec-3] - Added model object 'pList' of type [java.util.ArrayList] to request in view with name 'null' DEBUG [http-bio-8080-exec-3] - Forwarding to resource [index.jsp] in InternalResourceView 'null' 七月 17, 2017 9:36:36 下午 org.apache.catalina.core.ApplicationDispatcher invoke 严重: Servlet.service() for servlet jsp threw exception java.lang.NumberFormatException: For input string: "title" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) ``` mapper.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="cn.edu.mapper.PostMapper"> <resultMap type="post" id="postResult"> <id property="id" column="pid"></id> </resultMap> <insert id="insert" parameterType="post" useGeneratedKeys="true" keyProperty="id"> insert into t_post values(null,#{title},#{author},#{content},now()) </insert> <select id="findAll" resultMap="postResult"> select * from t_post </select> <select id="findById" parameterType="Integer" resultMap="postResult"> select * from t_post where pid = #{id} </select> <select id="findByTitle" parameterType="String" resultMap="postResult"> select * from t_post where title = #{title} </select> </mapper> ``` service ``` package cn.edu.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cn.edu.mapper.CommentMapper; import cn.edu.mapper.PostMapper; import cn.edu.pojo.Comment; import cn.edu.pojo.Post; import cn.edu.pojo.PostComment; @Service public class PostServiceImpl implements PostService { @Autowired private PostMapper postMapperImpl; @Override public String insert(Post post) { Integer id = postMapperImpl.insert(post); String msg = "1"; System.out.println(id); if(id == null){ msg = "0"; } return msg; } @Override public List<Post> findAllPosts() { return postMapperImpl.findAll(); } } ``` controller ``` package cn.edu.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import cn.edu.pojo.Comment; import cn.edu.pojo.Post; import cn.edu.service.PostService; @Controller public class PostController { @Autowired private PostService postServiceImpl; @RequestMapping("tolist") public String toList(Model model){ List<Post> pList = postServiceImpl.findAllPosts(); model.addAttribute("pList", pList); return "forward:index.jsp"; } } ```

java.lang.NumberFormatException: null 求大神!!

教师公寓与教师的关系 程序是想通过教师公寓的id获取teacher这个集合 比如几号公寓住着哪些教师 一直报转换类型错误 求大神看看 service里面的代码 public static List<Teacher> findTeacher(int id){ List<Teacher> teacher = new ArrayList<Teacher>(); SqlSession session =MyBatisUtils.getSqlSession(); try{ TeacherApartmentDaoMapper teacherapartmentMapper = session.getMapper(TeacherApartmentDaoMapper.class); teacher = teacherapartmentMapper.findTeacher(id); }catch(Exception e){ e.printStackTrace(); }finally{ MyBatisUtils.closeSqlSession(session); } return teacher; } Action里面的代码 @Action(value="findTeacher") public void findTeacher()throws Exception{ ServletActionContext.getResponse().setCharacterEncoding("utf-8"); List<Teacher> teacher = TeacherApartmentService.findTeacher((Integer.parseInt(ServletActionContext.getRequest().getParameter("ftId"))));// 这里报错 ServletActionContext.getResponse().getWriter() .print(new Gson().toJson(teacher)); ServletActionContext.getResponse().getWriter().flush(); ServletActionContext.getResponse().getWriter().close(); } 请问应该怎么改,这种1对多的关系做起卡了几天了 求大神指教 感激不尽!! 控制台报的错是java.lang.NumberFormatException: null

javascript java.lang.NumberFormatException

在写javascript的时候遇到了java.lang.NumberFormatException: For input string: "+num+" 代码是这样的 ``` var i = ${requestScope.records.size()}; if(i > 0){ for(var num = 0; num < i ; num++){ var li = "<li><a data-toggle='tab' href"+ "='#profile'>${requestScope.records["+num+"].className}</a></li>" alert(li); // $("#myClass").append(li); } } ``` 求解惑!

java.lang.NumberFormatException

## java.lang.NumberFormatException: For input string: "bDate" 这是什么原因啊 ,在线急等,帮忙支支招啊大神们

请教类型转换问题.java.lang.NumberFormatException 异常, 谢谢!

public void comAccount(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String b = req.getParameter("balance"); NewCustomer customer = new NewCustomer(); DAOFactory daoFactory = DAOFactory.getDAOFactory(DAOFactory.ORACLE); NewCustomerDAO newcustomerDao = daoFactory.getCustomerDAO(); newcustomerDao.heZhangJiSuan(customer); String a = customer.getBalance(); System.out.println("a=="+a); java.util.Vector error = new java.util.Vector(); int x,y; x = Integer.parseInt(b); [color=red]//程序执行到这里报异常 //java.lang.NumberFormatException: For input string: "200.00"[/color] y = Integer.parseInt(a); if( x>y ) { int c = x - y; error.add("已扣除费用"+c+"RMB"); req.setAttribute("errorss", error); }else{ error.add("账户余额不足,请充值!"); req.setAttribute("errors", error); } String address = "/page/comAccount.jsp"; req.getRequestDispatcher(address).forward(req, resp); }

java.lang.NumberFormatException ... input string "0.01"

在使用Long.parseLong("0.01")时候出现java.lang.NumberFormatException这种异常是为什么呢?难道使用使用这个方法时候只能传递整数字符串?自个基础太菜了。 :( :( :( :(

java.lang.IllegalArgumentException: argument type mismatch

在地址栏传值就会出现这个异常了。 Action代码: public ActionForward list(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String parentIdStr = request.getParameter("parentId"); Collection<Department> departmentList = null; if(parentIdStr==null){ departmentList = (List<Department>) departmentService.getTopLevel();//查询顶级部门 }else{ //查询子部门 long id = Long.valueOf(parentIdStr); departmentList = departmentService.getChildrenLevel(id); } request.setAttribute("departmentList", departmentList); System.out.println(departmentList.size()); return mapping.findForward("list"); } 在地址栏写http://localhost:8080/oa_01/DepartmentAction.do?method=list 这个是没问题的。 如果写http://localhost:8080/oa_01/DepartmentAction.do?method=list&parentId=1 就出现这个异常了。 异常消息 javax.servlet.ServletException: BeanUtils.populate org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495) org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) com.oa.filter.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:31) root cause java.lang.IllegalArgumentException: argument type mismatch sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789) org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684) org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713) org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019) org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493) org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) com.oa.filter.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:31)

SpringMVC报异常:java.lang.NumberFormatException: null

![图片说明](https://img-ask.csdn.net/upload/201607/05/1467699301_45985.jpg) ![图片说明](https://img-ask.csdn.net/upload/201607/05/1467699307_956735.jpg) ![图片说明](https://img-ask.csdn.net/upload/201607/05/1467699315_906431.jpg) ## 参考在线文档的网址是http://tool.oschina.net/apidocs/apidoc?api=javaEE6

java.lang.NumberFormatException: null的问题具体步骤应该怎么处理

!求具体的解决步骤啊,对程序一点都不懂,急急急急![图片说明](https://img-ask.csdn.net/upload/201512/23/1450866779_624947.png)[图片说明](https://img-ask.csdn.net/upload/201512/23/1450866706_60382.png)

异常java.lang.reflect.InvocationTargetException

``` java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.web.servlet.BaseServlet.service(BaseServlet.java:34) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) 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 com.web.filter.EncodingFilter.doFilter(EncodingFilter.java:36) 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:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) 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:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Integer.java:454) at java.lang.Integer.parseInt(Integer.java:527) at com.web.servlet.ProductServlet.findByPage(ProductServlet.java:52) ... 28 more ```

测试启动dubbo时报错:For input string: "xxxxx:20887"

报错信息如下: Exception in thread "main" java.lang.NumberFormatException: For input string: "0:0:0:2ce0:1f1:6d77:56fd%15:20887" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at com.alibaba.dubbo.common.URL.valueOf(URL.java:239) at com.alibaba.dubbo.config.ServiceConfig.exportLocal(ServiceConfig.java:503) at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:465) at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:281) at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:242) at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:143) at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:109) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:381) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:335) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:855) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) at com.zxfc.dubbo.demo.service.impl.Provider.main(Provider.java:9) Spring配置文件applicationContext-service.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:dubbo="http://code.alibabatech.com/schema/dubbo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> <!--定义了提供方应用信息,用于计算依赖关系;在 dubbo-admin 或 dubbo-monitor 会显示这个名字,方便辨识--> <dubbo:application name="demotest-provider" owner="programmer" organization="dubbox"/> <!--使用 zookeeper 注册中心暴露服务,注意要先开启 zookeeper--> <dubbo:registry address="zookeeper://localhost:2181"/> <!-- 用dubbo协议在20880端口暴露服务 --> <dubbo:protocol name="dubbo" port="20887" /> <!--使用 dubbo 协议实现定义好的 api.PermissionService 接口--> <dubbo:service interface="com.zxfc.dubbo.demo.service.DemoService" ref="demoService" protocol="dubbo" /> <!--具体实现该接口的 bean--> <bean id="demoService" class="com.zxfc.dubbo.demo.service.impl.DemoServiceImpl"/> </beans> 这个问题困扰了我好长时间了,由于这个问题导致我如法向下继续学习dubbo,希望dubbo大牛能帮忙看看,感激不尽。。。。。

用的spring mvc 添加了分页 功能后一直报错 求大神解决

org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver]Resolving exception from handler [com.app.controller.ManageController@185c0de]: java.lang.NumberFormatException: For input string: "" 2016-4-23 22:21:20 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [hnszf] in context with path [/hnszf] threw exception [Request processing failed; nested exception is java.lang.NumberFormatException: For input string: ""] with root cause java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:470) at java.lang.Integer.parseInt(Integer.java:499) at com.app.controller.ManageController.forJsp(ManageController.java:183) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:427) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:415) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:788) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:717) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) 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.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:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:662) [org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver]Resolving exception from handler [com.app.controller.ManageController@185c0de]: java.lang.NumberFormatException: For input string: "" [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver]Resolving exception from handler [com.app.controller.ManageController@185c0de]: java.lang.NumberFormatException: For input string: "" [org.springframework.web.servlet.DispatcherServlet]Could not complete request java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:470) at java.lang.Integer.parseInt(Integer.java:499) at com.app.controller.ManageController.forJsp(ManageController.java:183) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:427) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:415) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:788) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:717) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) 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.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:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:662)

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Linux面试题(2020最新版)

文章目录Linux 概述什么是LinuxUnix和Linux有什么区别?什么是 Linux 内核?Linux的基本组件是什么?Linux 的体系结构BASH和DOS之间的基本区别是什么?Linux 开机启动过程?Linux系统缺省的运行级别?Linux 使用的进程间通信方式?Linux 有哪些系统日志文件?Linux系统安装多个桌面环境有帮助吗?什么是交换空间?什么是root帐户什么是LILO?什...

将一个接口响应时间从2s优化到 200ms以内的一个案例

一、背景 在开发联调阶段发现一个接口的响应时间特别长,经常超时,囧… 本文讲讲是如何定位到性能瓶颈以及修改的思路,将该接口从 2 s 左右优化到 200ms 以内 。 二、步骤 2.1 定位 定位性能瓶颈有两个思路,一个是通过工具去监控,一个是通过经验去猜想。 2.1.1 工具监控 就工具而言,推荐使用 arthas ,用到的是 trace 命令 具体安装步骤很简单,大家自行研究。 我的使用步骤是...

学历低,无法胜任工作,大佬告诉你应该怎么做

微信上收到一位读者小涛的留言,大致的意思是自己只有高中学历,经过培训后找到了一份工作,但很难胜任,考虑要不要辞职找一份他能力可以胜任的实习工作。下面是他留言的一部分内容: 二哥,我是 2016 年高中毕业的,考上了大学但没去成,主要是因为当时家里经济条件不太允许。 打工了三年后想学一门技术,就去培训了。培训的学校比较垃圾,现在非常后悔没去正规一点的机构培训。 去年 11 月份来北京找到了一份工...

JVM内存结构和Java内存模型别再傻傻分不清了

讲一讲什么是Java内存模型 Java内存模型虽说是一个老生常谈的问题 ,也是大厂面试中绕不过的,甚至初级面试也会问到。但是真正要理解起来,还是相当困难,主要这个东西看不见,摸不着。 这是一个比较开放的题目,面试官主要想考察的是对Java内存模型的了解到了什么程度了,然后根据回答进行进一步的提问 下面,我们就这个问题的回答列一下我们的思路 具体的思路如下: 说一说Java内存模型的缘由 简略辨析...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

Google 与微软的浏览器之争

浏览器再现“神仙打架”。整理 | 屠敏头图 | CSDN 下载自东方 IC出品 | CSDN(ID:CSDNnews)从 IE 到 Chrome,再从 Chrome 到 Edge,微软与...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

85后蒋凡:28岁实现财务自由、34岁成为阿里万亿电商帝国双掌门,他的人生底层逻辑是什么?...

蒋凡是何许人也? 2017年12月27日,在入职4年时间里,蒋凡开挂般坐上了淘宝总裁位置。 为此,时任阿里CEO张勇在任命书中力赞: 蒋凡加入阿里,始终保持创业者的冲劲,有敏锐的...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

什么时候跳槽,为什么离职,你想好了么?

都是出来打工的,多为自己着想

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

立即提问
相关内容推荐