报错,For input String“name”,input输入的值能查询,但是input报错

数据库的表名报错情况eclipse报错情况,但是这里可以看出了以及查询成功了,连查询的size为1都显示出来了
查询界面的input框
![下面就是后台 java查询数据库的代码,先提取input框里面的值,input的name=“liuyan”,这里先检查story表里面有没有这个小说名,然后再查询该小说留言表。]

 @RequestMapping(value="/liuyan")
public ModelAndView liuyan(@RequestParam(value="liuyan", required=false) String liuyan, 
        HttpSession httpSession){
    System.out.println(liuyan);
    String sql = "select * from story where sname = '"+liuyan+"'";
    System.out.println(sql);
    String viewname="";
    final int[] isExist = new int[1];
    isExist[0] = 0;
    jt.query(sql, new RowCallbackHandler(){
        public void processRow(ResultSet rs) throws SQLException {
            if (rs.isFirst()) {
                isExist[0]=1;
            }
        }
    });
    if(isExist[0]==1) {
        String sql1 ="select * from "+liuyan+" limit 0,1000";
        System.out.println(sql1);
          viewname = "liuyan";
            final List<liuyan>liuyans = new ArrayList<liuyan>();
            jt.query(sql1, new RowCallbackHandler(){
                public void processRow(ResultSet rs1) throws SQLException {
                    System.out.println(rs1.getFetchSize());
                    while (!rs1.isAfterLast()) {
                        liuyan liuyanss = new liuyan(rs1.getString(1),
                                                rs1.getInt(2),
                                                rs1.getString(3),
                                                rs1.getString(4));
                        liuyans.add(liuyanss);
                        System.out.println(liuyans);
                        rs1.next();
                    }
                }
            });
            httpSession.setAttribute("liuyan", liuyan);
            System.out.println(liuyans.size());
            ModelAndView mv = new ModelAndView(viewname);
            mv.addObject("liuyans", liuyans);
            return mv;
    } else {
        httpSession.setAttribute("liuyan", liuyan);
        viewname = "chaxun_failed";
        ModelAndView mv = new ModelAndView(viewname);
        mv.addObject("liuyan", liuyan);

        return mv;

    }
   }

10个回答

${ liuyans.lname } 这个应该有问题吧,liuyans是个list,没有lname属性。parseInt可能是渲染标签带来的,最好是列一下第2个exception图的全部内容。

feelcycle_07
默默悟问 另外一般也要实现implements Serializable
大约 2 年之前 回复
feelcycle_07
默默悟问 回复qq_24932993: model类一般属性用private,然后实现set和get方法。有些bean是根据方法来找属性的,所以可能是因为没有get方法导致。
大约 2 年之前 回复
qq_24932993
qq_24932993 我两种都贴出来了,lname在package com.cx.shixun.model;这个下面的一个数据封装包中,我在下面贴出来了的
大约 2 年之前 回复

String sql1 ="select * from "+liuyan+" limit 0,1000"; 这是什么鬼

qq_24932993
qq_24932993 就是根据前台输入到input框里面的值,然后就是这里的liuyan这个对象的值多嘛,以此为对象查询该表的前1000条结果
大约 2 年之前 回复

你可以看看在你转到mv视图里面把liuyans遍历出来的时候是不是正确的

jsp:

 <div id="c1" class="content">
        <form action="liuyan" method="post">
        <table>
        <tr>
        <td style="width:400px">留言信息</td>
        <td style="width:150px"></td>
        <td style="width:150px"></td>
        </tr>
                             查询小说留言:<input type="text" name="liuyan"/><input type="submit" style="float-left:50px" value="查询" />
        </table>
        </div>

java:

 @RequestMapping(value="/liuyan")
public ModelAndView liuyan(@RequestParam(value="liuyan", required=false) String liuyan, 
        HttpSession httpSession){
    System.out.println(liuyan);
    String sql = "select * from story where sname = '"+liuyan+"'";
    System.out.println(sql);
    String viewname="";
    final int[] isExist = new int[1];
    isExist[0] = 0;
    jt.query(sql, new RowCallbackHandler(){
        public void processRow(ResultSet rs) throws SQLException {
            if (rs.isFirst()) {
                isExist[0]=1;
            }
        }
    });
    if(isExist[0]==1) {
        String sql1 ="select * from "+liuyan+" limit 0,1000";
        System.out.println(sql1);
          viewname = "liuyan";
            final List<liuyan>liuyans = new ArrayList<liuyan>();
            jt.query(sql1, new RowCallbackHandler(){
                public void processRow(ResultSet rs1) throws SQLException {
                    System.out.println(rs1.getFetchSize());
                    while (!rs1.isAfterLast()) {
                        liuyan liuyanss = new liuyan(rs1.getString(1),
                                                rs1.getInt(2),
                                                rs1.getString(3),
                                                rs1.getString(4));
                        liuyans.add(liuyanss);
                        System.out.println(liuyans);
                        rs1.next();
                    }
                }
            });
            httpSession.setAttribute("liuyan", liuyan);
            System.out.println(liuyans.size());
            ModelAndView mv = new ModelAndView(viewname);
            mv.addObject("liuyans", liuyans);
            return mv;
    } else {
        httpSession.setAttribute("liuyan", liuyan);
        viewname = "chaxun_failed";
        ModelAndView mv = new ModelAndView(viewname);
        mv.addObject("liuyan", liuyan);

        return mv;

    }
   }

目的jsp页面:

 <%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
        <%@page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<a href="admin">回到管理页面</a>
${ liuyans.lname }的热门留言:
<div class="link">      <table><tr><td>用户名</td><td>留言</td><td>电话号码</td><td></td></tr>
<c:forEach items="${liuyans}" var="item">
<tr><td>${ item.lname }</td><td><p>${ item.text }</p></td><td><a>${ item.lphone }</a></td><td><a herf="/liuyan/${item.id}">删除</a></td>
</tr>
</c:forEach>
</table></div>
</body>
</html>

把前面的那个${ liuyans. lname}删除后就是这样的报错

就只有目的jsp修改了,其他都没有改;下面是目的jsp修改后的代码

 <%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<a href="admin">回到管理页面</a>
的热门留言:
<div class="table" style="overflow:auto;height:300px" >
<table border="1px" bordercolor="red"><tr><td>用户名</td><td>留言</td><td>电话号码</td><td></td></tr>
<tr><td style="width:400px">小说名</td><td style="width:150px"></td></tr>
<c:forEach items="${liuyans}" var="item">
<tr><td>${ item.lname }</td><td><p>${ item.text }</p></td><td><a>${ item.lphone }</a></td><td><a herf="/liuyan/${item.id}">删除</a></td>
</tr>
</c:forEach>
</table></div>
</body>
</html>

莫名其妙什么都没做就成了这样的错误了

这是被java后台引用的数据封装的包

 package com.cx.shixun.model;

public class liuyan {
           public String lname;
           public int id;
           public String text;
           public String lphone;
        public liuyan() {
            super();
            // TODO Auto-generated constructor stub
        }
        @Override
        protected Object clone() throws CloneNotSupportedException {
            // TODO Auto-generated method stub
            return super.clone();
        }
        @Override
        public boolean equals(Object obj) {
            // TODO Auto-generated method stub
            return super.equals(obj);
        }
        @Override
        protected void finalize() throws Throwable {
            // TODO Auto-generated method stub
            super.finalize();
        }
        @Override
        public int hashCode() {
            // TODO Auto-generated method stub
            return super.hashCode();
        }
        @Override
        public String toString() {
            // TODO Auto-generated method stub
            return super.toString();
        }
        public liuyan(String lname, int id, String text, String lphone) {
            super();
            this.lname = lname;
            this.id = id;
            this.text = text;
            this.lphone = lphone;
        }


}

第一个错误:

 HTTP Status 500 – Internal Server Error

Type Exception Report

Message An exception occurred processing JSP page [/WEB-INF/pages/liuyan.jsp] at line [17]

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

org.apache.jasper.JasperException: An exception occurred processing JSP page [/WEB-INF/pages/liuyan.jsp] at line [17]

14: <div class="table" style="overflow:auto;height:300px" >
15: <table border="1px" bordercolor="red"><tr><td>鐢ㄦ埛鍚�</td><td>鐣欒█</td><td>鐢佃瘽鍙风爜</td><td></td></tr>
16: <c:forEach var="item" items="${ liuyans }">
17: <tr><td><p>${ item.lname }</p></td><td><p>${ item.text }</p></td><td><a>${ item.lphone }</a></td><td><a herf="/liuyan/${item.id}">鍒犻櫎</a></td>
18: </tr>
19: </c:forEach>
20: </table></div>


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:588)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:481)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1243)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

Root Cause

javax.el.PropertyNotFoundException: Property [lname] not found on type [com.cx.shixun.model.liuyan]
    javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:260)
    javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:212)
    javax.el.BeanELResolver.property(BeanELResolver.java:347)
    javax.el.BeanELResolver.getValue(BeanELResolver.java:92)
    org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:110)
    org.apache.el.parser.AstValue.getValue(AstValue.java:169)
    org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
    org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:944)
    org.apache.jsp.WEB_002dINF.pages.liuyan_jsp._jspx_meth_c_005fforEach_005f0(liuyan_jsp.java:179)
    org.apache.jsp.WEB_002dINF.pages.liuyan_jsp._jspService(liuyan_jsp.java:133)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1243)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

Note The full stack trace of the root cause is available in the server logs.
Apache Tomcat/8.5.23

第二个错误:

 HTTP Status 500 – Internal Server Error
Type Exception Report

Message javax.el.PropertyNotFoundException: Property [lname] not found on type [com.cx.shixun.model.liuyan]

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: Property [lname] not found on type [com.cx.shixun.model.liuyan]
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:565)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:481)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1243)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
Root Cause

javax.el.PropertyNotFoundException: Property [lname] not found on type [com.cx.shixun.model.liuyan]
    javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:260)
    javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:212)
    javax.el.BeanELResolver.property(BeanELResolver.java:347)
    javax.el.BeanELResolver.getValue(BeanELResolver.java:92)
    org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:110)
    org.apache.el.parser.AstValue.getValue(AstValue.java:169)
    org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
    org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:944)
    org.apache.jsp.WEB_002dINF.pages.liuyan_jsp._jspx_meth_c_005fforEach_005f0(liuyan_jsp.java:179)
    org.apache.jsp.WEB_002dINF.pages.liuyan_jsp._jspService(liuyan_jsp.java:133)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1243)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
Note The full stack trace of the root cause is available in the server logs.

Apache Tomcat/8.5.23

看看Exception的parseInt是哪里调用的,直接问题是你渲染的一个值被parseInt,但是string是"name"。问题可能是你传或取的值不对。

qq_24932993
qq_24932993 回复feelcycle_07: 我把两种错误显示都贴出来了,数据库中没有空数据。在目的jsp之前都正常执行,到了liuyan.jsp就出错,我把<c:ForEach>这一部分删除就能直接到达liuyan.jsp,后台查询仍然成功,只是在liuyan.jsp中没有展示出来,可能就是查询了,但是值的问题。
大约 2 年之前 回复
feelcycle_07
默默悟问 回复qq_24932993: 日志那应该有具体的exception内容吧,最好核对那个,这样看不好确认。是不是字段名不对,或者存在为null的字段。
大约 2 年之前 回复
qq_24932993
qq_24932993 回复feelcycle_07: 我又贴了新的目的jsp的代码了,前面的没改了,应该出在目的jsp上面,因为后台能够执行操作,能够查询数据库表中我自己添加的那一行数据,但是在目的jsp中没法读出来
大约 2 年之前 回复
feelcycle_07
默默悟问 回复qq_24932993: 另外问题不好解决就再列下。
大约 2 年之前 回复
qq_24932993
qq_24932993 回复qq_24932993: 我发现了一个问题就是我把目的的${ liuyans.name }删除后就没有这个问题了 但是出现了另外一个问题 ,上面贴出来的${ liuyans.name}是我把name改为lname之前的报错。
大约 2 年之前 回复
qq_24932993
qq_24932993 我贴出来了,所有相关的代码
大约 2 年之前 回复
qq_24932993
qq_24932993 回复feelcycle_07: 我好像没有用parselnt
大约 2 年之前 回复
feelcycle_07
默默悟问 回复qq_24932993: 你把exception的内容贴全看下。
大约 2 年之前 回复
qq_24932993
qq_24932993 就是前台jsp里面的那个input框下面的name=“liuyan”,传送到后台的多嘛,然后后台提取name=“liuyan”的字段,放到新的liuyan这个对象里面,然后拿去查询
大约 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
测试启动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大牛能帮忙看看,感激不尽。。。。。

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"; } } ```

HTTP Status 500 - For input string: "3.0"

我在做一个增加数据功能的网页,测试时出现了错误提示如下(输入整型数据时不报错,但是输入浮点型数据时却报错): java.lang.NumberFormatException: For input string: "2.0" java.lang.NumberFormatException.forInputString(Unknown Source) java.lang.Integer.parseInt(Unknown Source) java.lang.Integer.parseInt(Unknown Source) example4.Insert.doPost(Insert.java:31) javax.servlet.http.HttpServlet.service(HttpServlet.java:650) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.68 logs. 相关代码如下: view界面代码: <form action="Insert" method="post"> <table border="1"> <tr> <td> X:</td> <td><input name ="x"></td> </tr> <tr> <td> Y:</td> <td><input name ="y"></td> </tr> <tr> <td colspan="2"> <center> <input type="submit" value="提交"> javabean代码: //获取前台页面数据 String x3 =request.getParameter("x"); double x = Double.parseDouble(x3); String y1 =request.getParameter("y"); double y = Double.parseDouble(y1); 我是新手,请各位大神帮我诊断一下,感激不尽!

input表单查询,不输入值时后台显示 数据类型转换错误,

前台代码:订单号: <input class="easyui-textbox" name="oid" id="select" style="width:150px"> 后台代码:![图片说明](https://img-ask.csdn.net/upload/201603/15/1458029094_89739.png) 原订单号为long型,后台转为字符串后执行的查询操作。 正常输入订单号查询时,可以查到,但是如果不输入值,直接点击查询会报错。好像是数据类型转换错误。不过我在Java后台不是已经直接做了转换的,怎么还是这样,求解答 严重: Servlet.service() for servlet [spring] in context with path [/xxcnew] threw exception [Request processing failed; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'order' on field 'oid': rejected value []; codes [typeMismatch.order.oid,typeMismatch.oid,typeMismatch.long,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [order.oid,oid]; arguments []; default message [oid]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'long' for property 'oid'; nested exception is java.lang.NumberFormatException: For input string: ""]] with root cause

For input string: "0.01"

DecimalFormat df = new DecimalFormat("0.00");//格式化小数 String str = df.format(bean.getAmount()/100.0); bean.setAmount(Integer.parseInt(str));//这行报错 求大神解决

spring发布dubbo时报错For input string

三月 22, 2018 12:06:16 上午 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.NumberFormatException: For input string: "0:0:0:2ce0:1f1:6d77:56fd%15:20880" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) 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.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 下面是我的spring配置文件 <context:component-scan base-package="com.taotao.service"/> <dubbo:application name="taotao-manager"/> <dubbo:registry protocol="zookeeper" address="192.168.231.128:2181,192.168.231.128:2182,192.168.231.128:2183"/> <dubbo:protocol name="dubbo" port="20880"/> <dubbo:service interface="com.zxfc.service.ItemService" ref="itemServiceImpl"/>

页面显示不出数据,报For input string: ""错

if判断里的原本是注释掉的//adminInfoService.getAdminInfoFunctions(admininfo.getId()).getFs().size()>0,可是getFs取的值为空,登录进不去,所以先写了true ``` @RequestMapping(value="/login",produces="text/html;charset=UTF-8") @ResponseBody public String login(AdminInfo ai,ModelMap model){ //登录验证 AdminInfo admininfo = adminInfoService.getAdminInfoByCond(ai); if(admininfo!=null&&admininfo.getName()!=null){ System.out.println(admininfo.getName()+":"+admininfo.getFs()); //验证过过后,在判断是否已为该管理员分配功能权限 if(true){//adminInfoService.getAdminInfoFunctions(admininfo.getId()).getFs().size()>0 //验证通过且已分配功能权限,则将admininfo对象存入model中 model.put("admin", admininfo); //以json格式向页面发送成功信息 return "{\"success\":\"true\",\"message\":\"登录成功\"}"; }else{ return "{\"success\":\"false\",\"message\":\"您没有权限\"}"; } }else return "{\"success\":\"true\",\"message\":\"登录失败\"}"; } ``` 显示页面usermanager.jsp的关键代码 ``` <body class="easyui-layout"> <div data-options="region:'noth',border:false" style="height:60px;background:#B3DFDA;padding:10px"> north region </div> <div data-options="region:'west',split:true,title:'功能菜单'" style="width:200px;padding:10px"> <ul id="tt"></ul><!-- 定义树 --> </div> <div data-options="region:'south',border:false" style="height:50px;background:#A9FACD;padding:10px"> south region </div> <div data-options="region:'center',title:'主界面'"> <div id="tabs" data-options="fit:true" class="easyui-tabs" style="width:500px;heigth:250px"> </div> </div> <script type="text/javascript"> //为树指定数据 $("#tt").tree({ url:'admininfo/getTree?adminid=${sessionScope.admin.id}' }); $('#tt').tree({ onclick:function(node){ if("用户列表"==node.text){ if($('#tabs').tabs('exits','用户列表')){ $('#tabs').tabs('select','用户列表'); }else{ $('#tabs').tabs('add',{ title:nodel.text, href:'userlist.jsp', closable:true }); } }else if("管理员列表"==node.text){ if($('#tabs').tabs('exits','管理员列表')){ $('#tabs').tabs('select','管理员列表'); }else{ $('#tabs').tabs('add',{ title:nodel.text, href:'adminlist.jsp', closable:true }); } }else if("退出系统"==nodel.text){ $ajax({ url:'admininfo/loginout', sucess:function(data){ window.loction.href="admin_login.jsp"; } }) } } }); </script> ``` 这是getAdminInfoByCond方法的映射文件 ``` <select id="getAdminInfoByCond" parameterType="com.digital.pojo.AdminInfo" resultType="com.digital.pojo.AdminInfo"> select * from admin_info where name=#{name} and pwd=#{pwd} </select> ``` 这是报错: ![图片说明](https://img-ask.csdn.net/upload/201904/18/1555576897_543245.png) getAdminInfoFunctions的映射文件: ``` <select id="getAdminInfoFunctions" parameterType="int" resultMap="getAdminInfoFunctionsMap"> select ai.id,ai.name,f.id fuid,f.name fname,f.parentid fpid,f.isleaf fisleaf,f.nodeorder fno from admin_info ai left join powers p on ai.id=p.aid join functions f on p.fid=f.id where ai.id=#{id} ORDER BY fpid </select> <resultMap type="com.digital.pojo.AdminInfo" id="getAdminInfoFunctionsMap"> <id property="id" column="id"/> <result property="name" column="name"/> <collection property="fs" ofType="com.digital.pojo.Functions"> <id property="id" column="fuid"/> <result property="name" column="fname"/> <result property="parentid" column="fpid"/> <result property="isleaf" column="fisleaf"/> </collection> </resultMap> ```

hql转换成sql以后频报for input string “xxx”

这是sql写法 ``` public List<RegMarpripInfo> getAllMarpripInfo(int offset, int length) { // List<RegMarpripInfo> entitylist = null; String hql = "select new Map( o.id as id ,o.entname as entname ,o.uniscid as uniscid, t.name as enttype, o.regno as regno , o.opscope as opscope, o.regcap as regcap ,i.name as industryco ,o.credit as credit, o.estdate as estdate ) from RegMarpripInfo o,CodeInd i,CodeEnttype t where 1=1 and o.enttype=t.code and o.industryco=i.code "; Query query = sessionFactory.getCurrentSession().createQuery(hql); query.setFirstResult(offset); query.setMaxResults(length); return query.list(); } ``` 这是sql写法的 ``` public List<RegMarpripInfo> getAllMarpripInfo(int offset, int length) { // List<RegMarpripInfo> entitylist = null; String sql = "select o.ID as id ,o.ENTNAME as entname ,o.UNISCID as uniscid, t.name as enttype, o.REGNO as regno , o.OPSCOPE as opscope, o.REGCAP as regcap ,i.name as industryco ,o.CREDIT as credit, o.ESTDATE as estdate from reg_marpripinfo o " + "LEFT JOIN code_indcode i on (i.NAME=o.INDUSTRYCO) " + "LEFT JOIN code_enttype t on (t.CODE=o.ENTTYPE) where 1=1 "; Query query = sessionFactory.getCurrentSession().createSQLQuery(sql); query.setFirstResult(offset); query.setMaxResults(length); return query.list(); } ``` 因为不太了解注解写hql左连接就转成了sql写法,但是sql写法一直报错for input string, 要展示的列全部报这个错, ``` 严重: Servlet.service() for servlet springMVC threw exception java.lang.NumberFormatException: For input string: "entname" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.parseInt(Integer.java:527) at javax.el.ArrayELResolver.coerce(ArrayELResolver.java:160) at javax.el.ArrayELResolver.getValue(ArrayELResolver.java:45) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54) at org.apache.el.parser.AstValue.getValue(AstValue.java:123) ``` 项目框架spring mvc hibernate注解 jsp 控制层代码 ``` Page page = marManager.queryForPage(Integer.valueOf(pageNo), 10); request.setAttribute("page", page); List<RegMarpripInfo> mar = page.getList(); request.setAttribute("marList", mar); ``` ![页面展示的代码](https://img-ask.csdn.net/upload/201704/17/1492393550_147911.png)

java.lang.NumberFormatException

``` package foodOnline.servlet; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import foodOnline.dao.FoodDao; import foodOnline.dao.impl.FoodDaoImpl; import foodOnline.entity.Food; //49行categoryId报错说转换异常,看了老半天也改了还是说错误 public class addServlet extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { FileItemFactory factory=new DiskFileItemFactory(); ServletFileUpload upload=new ServletFileUpload(factory); String chineseName=null; String englishName=null; String description=null; String filename=null; int categoryId=0; try { List<FileItem>list=upload.parseRequest(request); for(FileItem item:list){ if(item.isFormField()){ if("chineseName".equals(item.getFieldName())){ chineseName=item.getString("UTF-8"); }else if("englishName".equals(item.getFieldName())){ englishName=item.getString("UTF-8"); }else if("description".equals(item.getFieldName())){ description=item.getString("UTF-8"); }else if("categoryId".equals(item.getFieldName())){ categoryId = Integer.parseInt(item.getString()); } }else{ String clientFilename=item.getName(); String ext = clientFilename.substring(clientFilename .lastIndexOf(".")); filename = englishName + ext; ServletContext application=request.getSession().getServletContext(); String filepath=application.getRealPath("images/menus/"+filename); item.write(new File(filepath)); } } if(chineseName!=null&&englishName!=null&&description!=null&&categoryId!=0){ Food food=new Food(0,chineseName,englishName,categoryId,description); FoodDao fd=new FoodDaoImpl(); fd.addFoods(food); response.sendRedirect("food/admin/foodsListServlet"); }else{ request.getRequestDispatcher("error.jsp").forward(request, response); } } catch (Exception e) { e.printStackTrace(); request.getRequestDispatcher("error.jsp").forward(request, response); } } } ``` 然后现在出现新的错误, com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '??…è’???—é??' for key 'ChineseName'

spring mvc不用<form:input>只用input却能提交到ModelAttribute

Product类 ``` package app06; import java.util.List; import javax.validation.constraints.NotNull; import org.springframework.web.multipart.MultipartFile; public class Product { private static final long servialVersionUID = 74458L; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Float getPrice() { return price; } public void setPrice(Float price) { this.price = price; } private String name; private String description; private Float price; private List<MultipartFile> images; public List<MultipartFile> getImages() { return images; } public void setImages(List<MultipartFile> images) { this.images = images; } } ``` ProductController类 ``` package app06; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.client.HttpServerErrorException; import org.springframework.web.multipart.MultipartFile; @Controller public class ProductController { @RequestMapping("/product_input") public String inputProduct(Model model){ model.addAttribute("product",new Product()); return "FileUpload"; } @RequestMapping("/product_save") public String saveProduct(HttpServletRequest servletRequest,@ModelAttribute Product product,BindingResult bindingResult,Model model) throws IOException{ //return null; List<MultipartFile> files = product.getImages(); List<String> fileNames = new ArrayList<String>(); //File mkdir = new File(servletRequest.getServletContext().getRealPath("/image")); //mkdir.mkdir(); if(null != files && files.size() > 0){ for(MultipartFile mpf : files){ String fileName = mpf.getOriginalFilename(); fileNames.add(fileName); File parFile = new File(servletRequest.getServletContext().getRealPath("/").toString()).getParentFile().getAbsoluteFile(); parFile = new File(parFile,"/app06_file"); if(!parFile.exists()){ parFile.mkdirs(); } File imageFile = new File(parFile,fileName); System.out.println(imageFile); if(!imageFile.exists()){ imageFile.createNewFile(); } try{ mpf.transferTo(imageFile); }catch(Exception e){ e.printStackTrace(); } } } return null; } } ``` FileUpload.jsp ``` <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'FileUpload.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <form:form commandName="product" action="product_save" method="post" enctype="multipart/form-data"> <fieldset> <legend>Add a product</legend> Product Name : <form:input path="name"/><br/> Description: <form:input path="description"/><br/> Price:<form:input path="price"/><br/> Product image : <input type="file" name="images[0]"><br/> <input type="reset"><input type="submit" value="Add A Product"> </fieldset> </form:form> <body> </body> </html> ``` 这个代码运行是能成功上传文件的 但是我不明白 <input type="file" name="images[0]">为什么不需要用<form:input>就能被后台的@ModelAttribute Product这个接收到 并且name的image要加个[0] 就算是不加这个[0]也是能成功的 因为我是大一新生一枚 是按照书上一步一步来的 不太了解问问题的方式 求大神指导

结构成员含string类型数组,成员的输入问题

要求输入的name可含空格,不知道错哪了,新手求好心人解答,万分感谢! #include<iostream> #include<string> using namespace std; struct donation{ string name; double number; }; int main() { cout<<"Input the number of donater: "; int d_number; cin>>d_number; donation * p = new donation[d_number]; for(int i = 0; i < d_number; i++) { cout<<"Input the name of the donater."; getline(cin,p[i].name); cout<<"Input the number."; cin>>p[i].number; } for(int i = 0; i < d_number; i++) cout<<p[i].name<<" "<<p[i].number<<endl; return 0; }

难道这类问题的出现就我一个人?

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0' defined in class path resource [spring-mybatis.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml]: Cannot resolve reference to bean 'druidDataSource' while setting bean property 'druidDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'druidDataSource' defined in class path resource [spring-mybatis.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'initialSize'; nested exception is java.lang.NumberFormatException: For input string: "${druid.initialSize}" 当我删除除(ClassName,url,pass,name)以外的配置时,报初始化错误- dataSource init error。该怎么解决? 关于连接池的配置基本是没有问题的。 <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.mysp.dao"></property> <property name="BeanName" value="sqlSessionFactory"></property> </bean> 之前用DBCP的连接池,总是显示找不到${driver}。。 求求大神 帮看看是为什么。

调用JSON.parse ()函数对字符串对象进行转化的时候,报错Unexpected end of JSON input

具体的代码如下:先从前端读取的json文件中获取内容再进行转化: ``` function handleFiles() { var selectedFile = document.getElementById("files").files[0];//获取读取的File对象 var name = selectedFile.name;//读取选中文件的文件名 var size = selectedFile.size;//读取选中文件的大小 console.log("文件名:"+name+"大小:"+size); var reader = new FileReader(); reader.readAsText(selectedFile);//读取文件的内容 // 下面这一行报错了!!!! var json = JSON.parse(reader.result.toString().replace(/\n/g, '')); var temp = 0; for(i=0;i< length(json);i++){ for(j=0;j<length(json)-i-1;j++){ if(json[j+1].value>json[j].value){ temp = json[j+1]; json[j+1] = json[j]; json[j] = temp; } } } return json; ``` 但如果设置断点调试则可以进行,是为什么?

【struts2】前端页面上多个name相同的input text,在action中的获取方式

比如页面上有 <input type="text" name="kp" /> <input type="text" name="kp" /> <input type="text" name="kp" /> 页面被提交后,在后台action用List<String> kp = new ArrayList<String>(); 就可以得到3个input的值了 我知道同名checkbox可以用系统自带的拦截checkbox的拦截器拦截获得选中的值,但是多个name相同的input text是怎么在后台得到的数据,是什么原理?是param拦截器来做这个事吗?有谁能给讲解下原理吗?谢谢

求助,本地运行无异常,idea打包后发布到服务器就报错

``` org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroFilterFactoryBean' defined in class path resource [cc/mrbird/febs/common/authentication/ShiroConfig.class]: Unsatisfied dependency expressed through method 'shiroFilterFactoryBean' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [cc/mrbird/febs/common/authentication/ShiroConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.mgt.SecurityManager]: Factory method 'securityManager' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroRealm': Unsatisfied dependency expressed through field 'redisService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisService': Unsatisfied dependency expressed through field 'jedisPool'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisConfig': Unsatisfied dependency expressed through field 'port'; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "${spring.redis.port}" at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:767) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:508) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:240) at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:707) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139) at cc.mrbird.febs.FebsApplication.main(FebsApplication.java:17) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [cc/mrbird/febs/common/authentication/ShiroConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.mgt.SecurityManager]: Factory method 'securityManager' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroRealm': Unsatisfied dependency expressed through field 'redisService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisService': Unsatisfied dependency expressed through field 'jedisPool'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisConfig': Unsatisfied dependency expressed through field 'port'; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "${spring.redis.port}" at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:625) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:455) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1239) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:855) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:758) ... 18 common frames omitted Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.mgt.SecurityManager]: Factory method 'securityManager' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroRealm': Unsatisfied dependency expressed through field 'redisService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisService': Unsatisfied dependency expressed through field 'jedisPool'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisConfig': Unsatisfied dependency expressed through field 'port'; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "${spring.redis.port}" at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:620) ... 32 common frames omitted Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroRealm': Unsatisfied dependency expressed through field 'redisService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisService': Unsatisfied dependency expressed through field 'jedisPool'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisConfig': Unsatisfied dependency expressed through field 'port'; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "${spring.redis.port}" at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.resolveBeanReference(ConfigurationClassEnhancer.java:394) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:366) at cc.mrbird.febs.common.authentication.ShiroConfig$$EnhancerBySpringCGLIB$$b79cf09.shiroRealm(<generated>) at cc.mrbird.febs.common.authentication.ShiroConfig.securityManager(ShiroConfig.java:44) at cc.mrbird.febs.common.authentication.ShiroConfig$$EnhancerBySpringCGLIB$$b79cf09.CGLIB$securityManager$0(<generated>) at cc.mrbird.febs.common.authentication.ShiroConfig$$EnhancerBySpringCGLIB$$b79cf09$$FastClassBySpringCGLIB$$74415cdb.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) at cc.mrbird.febs.common.authentication.ShiroConfig$$EnhancerBySpringCGLIB$$b79cf09.securityManager(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ... 33 common frames omitted Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisService': Unsatisfied dependency expressed through field 'jedisPool'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisConfig': Unsatisfied dependency expressed through field 'port'; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "${spring.redis.port}" at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1239) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ... 56 common frames omitted Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisConfig': Unsatisfied dependency expressed through field 'port'; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "${spring.redis.port}" at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:391) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1239) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ... 69 common frames omitted Caused by: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "${spring.redis.port}" at org.springframework.beans.TypeConverterSupport.doConvert(TypeConverterSupport.java:80) at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:60) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ... 91 common frames omitted Caused by: java.lang.NumberFormatException: For input string: "${spring.redis.port}" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:569) at java.lang.Integer.valueOf(Integer.java:766) at org.springframework.util.NumberUtils.parseNumber(NumberUtils.java:210) at org.springframework.beans.propertyeditors.CustomNumberEditor.setAsText(CustomNumberEditor.java:115) at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:466) at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:439) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:192) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:117) at org.springframework.beans.TypeConverterSupport.doConvert(TypeConverterSupport.java:70) ... 95 common frames omitted ```

java程序报错,求大神找bug

package arraysofobjects; import java.util.Scanner; public class arraysofobjects { public static void main(String[] args) { Scanner input=new Scanner(System.in); students[] stu=new students[4]; String name; int grade; for(int i=0;i<stu.length;i++) { name=input.nextLine(); grade=input.nextInt(); stu[i]=new students(name,grade); } for(int i=0;i<stu.length;i++) { System.out.printf("name:%s\tgrades:%d\n",stu[i].name(),stu[i].grades()); } } } package arraysofobjects; public class students { private String _name; private int _grades; public students(String name,int grades) { this._name=name; this._grades=grades; } public String name() { return this._name; } public int grades() { return this._grades; } } 输入两行就开始报错了

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(); } }) } 点击提交的时候报上面的错

如何用php代码构建<input>设置值属性

<div class="post-text" itemprop="text"> <p>I'm not sure how word my question clearly, so here's what I'm trying to do with no success so far (simplified code)</p> <p>The end result I need on the page is:</p> <pre><code>&lt;input type="text" class="form-control" id="Colour" name="InputName7" value="&lt;?php echo $InputName7 ; ?&gt;"&gt; </code></pre> <p>I have a function to build this but the value attribute is rendering as a string instead of code... and I end up with "" as the string value. I don't understand why. </p> <p>Here's how I call the function:</p> <pre><code>$newItem = SetItemInputTag("Colour", $ItemCount, "&lt;?php echo $InputName7; ?&gt;", FALSE) </code></pre> <p>Here's function:</p> <pre><code>function SetItemInputTag($TagId, $ItemCount, $TagValue, $Disabled){ $InputTag = "&lt;input type='text' class='form-control' id='" . $TagId . "' name= 'InputName" . $ItemCount . "' disabled value='" . $TagValue . "'&gt;"; return $InputTag; } </code></pre> <p>I appreciate any help I can get!!</p> </div>

Kettle探索资源库报错

java.lang.RuntimeException: java.lang.RuntimeException: org.pentaho.di.core.exception.KettleException: Unable to get list of repository objects An error occurred executing SQL: SELECT NAME, MODIFIED_USER, MODIFIED_DATE, DESCRIPTION, ID_JOB FROM R_JOB WHERE ID_DIRECTORY = ? Error determining value metadata from SQL resultset metadata For input string: "4294967295"

学Python后到底能干什么?网友:我太难了

感觉全世界营销文都在推Python,但是找不到工作的话,又有哪个机构会站出来给我推荐工作? 笔者冷静分析多方数据,想跟大家说:关于超越老牌霸主Java,过去几年间Python一直都被寄予厚望。但是事实是虽然上升趋势,但是国内环境下,一时间是无法马上就超越Java的,也可以换句话说:超越Java只是时间问题罢。 太嚣张了会Python的人!找工作拿高薪这么简单? https://edu....

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

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

为什么程序猿都不愿意去外包?

分享外包的组织架构,盈利模式,亲身经历,以及根据一些外包朋友的反馈,写了这篇文章 ,希望对正在找工作的老铁有所帮助

Java校招入职华为,半年后我跑路了

何来 我,一个双非本科弟弟,有幸在 19 届的秋招中得到前东家华为(以下简称 hw)的赏识,当时秋招签订就业协议,说是入了某 java bg,之后一系列组织架构调整原因等等让人无法理解的神操作,最终毕业前夕,被通知调往其他 bg 做嵌入式开发(纯 C 语言)。 由于已至于校招末尾,之前拿到的其他 offer 又无法再收回,一时感到无力回天,只得默默接受。 毕业后,直接入职开始了嵌入式苦旅,由于从未...

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

@程序员:GitHub这个项目快薅羊毛

今天下午在朋友圈看到很多人都在发github的羊毛,一时没明白是怎么回事。 后来上百度搜索了一下,原来真有这回事,毕竟资源主义的羊毛不少啊,1000刀刷爆了朋友圈!不知道你们的朋友圈有没有看到类似的消息。 这到底是啥情况? 微软开发者平台GitHub 的一个区块链项目 Handshake ,搞了一个招募新会员的活动,面向GitHub 上前 25万名开发者派送 4,246.99 HNS币,大约价...

用python打开电脑摄像头,并把图像传回qq邮箱【Pyinstaller打包】

前言: 如何悄悄的打开朋友的摄像头,看看她最近过的怎么样,嘿嘿!这次让我带你们来实现这个功能。 注: 这个程序仅限在朋友之间开玩笑,别去搞什么违法的事情哦。 代码 发送邮件 使用python内置的email模块即可完成。导入相应的代码封装为一个send函数,顺便导入需要导入的包 注: 下面的代码有三处要修改的地方,两处写的qq邮箱地址,还有一处写的qq邮箱授权码,不知道qq邮箱授权码的可以去百度一...

做了5年运维,靠着这份监控知识体系,我从3K变成了40K

从来没讲过运维,因为我觉得运维这种东西不需要太多的知识面,然后我一个做了运维朋友告诉我大错特错,他就是从3K的运维一步步到40K的,甚至笑着说:我现在感觉自己什么都能做。 既然讲,就讲最重要的吧。 监控是整个运维乃至整个产品生命周期中最重要的一环,事前及时预警发现故障,事后提供详实的数据用于追查定位问题。目前业界有很多不错的开源产品可供选择。选择一款开源的监控系统,是一个省时省力、效率最高的方...

C++(继承):19---虚基类与虚继承(virtual)

一、菱形继承 在介绍虚继承之前介绍一下菱形继承 概念:A作为基类,B和C都继承与A。最后一个类D又继承于B和C,这样形式的继承称为菱形继承 菱形继承的缺点: 数据冗余:在D中会保存两份A的内容 访问不明确(二义性):因为D不知道是以B为中介去访问A还是以C为中介去访问A,因此在访问某些成员的时候会发生二义性 缺点的解决: 数据冗余:通过下面“虚继承”技术来解决(见下) 访问...

再不跳槽,应届毕业生拿的都比我多了!

跳槽几乎是每个人职业生涯的一部分,很多HR说“三年两跳”已经是一个跳槽频繁与否的阈值了,可为什么市面上有很多程序员不到一年就跳槽呢?他们不担心影响履历吗? PayScale之前发布的**《员工最短任期公司排行榜》中,两家码农大厂Amazon和Google**,以1年和1.1年的员工任期中位数分列第二、第四名。 PayScale:员工最短任期公司排行榜 意外的是,任期中位数极小的这两家公司,薪资...

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

数据结构与算法思维导图

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

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

华为初面+综合面试(Java技术面)附上面试题

华为面试整体流程大致分为笔试,性格测试,面试,综合面试,回学校等结果。笔试来说,华为的难度较中等,选择题难度和网易腾讯差不多。最后的代码题,相比下来就简单很多,一共3道题目,前2题很容易就AC,题目已经记不太清楚,不过难度确实不大。最后一题最后提交的代码过了75%的样例,一直没有发现剩下的25%可能存在什么坑。 笔试部分太久远,我就不怎么回忆了。直接将面试。 面试 如果说腾讯的面试是挥金如土...

和黑客斗争的 6 天!

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

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

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

win10暴力查看wifi密码

刚才邻居打了个电话说:喂小灰,你家wifi的密码是多少,我怎么连不上了。 我。。。 我也忘了哎,就找到了一个好办法,分享给大家: 第一种情况:已经连接上的wifi,怎么知道密码? 打开:控制面板\网络和 Internet\网络连接 然后右击wifi连接的无线网卡,选择状态 然后像下图一样: 第二种情况:前提是我不知道啊,但是我以前知道密码。 此时可以利用dos命令了 1、利用netsh wlan...

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

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

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

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

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

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

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

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

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

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

女朋友过生日,我花了20分钟给她写了一个代理服务器

女朋友说:“看你最近挺辛苦的,我送你一个礼物吧。你看看想要什么,我来准备。” 我想了半天,从书到鞋子到电子产品最后到生活用品,感觉自己什么都不缺,然后和她说:“你省省钱吧,我什么都不需要。” 她坚持要送:“不行,你一定要说一个礼物,我想送你东西了。” 于是,我认真了起来,拿起手机,上淘宝逛了几分钟,但还是没能想出来缺点什么,最后实在没办法了:“这样吧,如果你实在想送东西,那你就写一个代理服务器吧”...

记一次腾讯面试,我挂在了最熟悉不过的队列上……

腾讯后台面试,面试官问:如何自己实现队列?

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

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

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

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

程序员写出这样的代码,能不挨骂吗?

当你换槽填坑时,面对一个新的环境。能够快速熟练,上手实现业务需求是关键。但是,哪些因素会影响你快速上手呢?是原有代码写的不够好?还是注释写的不够好?昨夜...

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

!大部分程序员只会写3年代码

如果世界上都是这种不思进取的软件公司,那别说大部分程序员只会写 3 年代码,恐怕就没有程序员这种职业。

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

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

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

立即提问
相关内容推荐