javascript - ajax级联操作的时候,总是报这个错误
PHPz
PHPz 2017-04-11 12:33:30
[JavaScript讨论组]
这是js部分
$('#yh_id').change(function(){    
                $.ajax({    
        url: '<%=basePath%>admin/cyd/con.html?id=' + $('#yh_id').val()+'&name='+new Date().getTime(),
        dataType: 'json',
        success : function(data){
        for(var j=0;j<3;j++){
            $('#yp_id').empty();
            $('#yp_id').append('');
            $('#cs_id').empty();
            $('#cs_id').append('');
            $('#sb_id').empty();
            $('#sb_id').append('');
            for(var i = 0; i< data.length;i++){
                $('#yp_id').append('');
            }
            }
            }
        })
        });
这是后台Java
 @RequestMapping(value = "/con")
         public void con(HttpServletRequest request, HttpServletResponse response, String id,String name) throws SQLException, IOException{
             
             ICommonDao daoyp = DBUtil.getDao();
            String sqlyp ="select b.* from wlpt_yh_yp a join wlpt_jy_yp b on a.yp_id =b.id " +
                    "WHERE b.`status` = 0 and a.yh_id= '"+id+"'";
            List Listyp= null;
            try {
                Listyp = daoyp.queryBusinessObjs(wlpt_jy_yp.class,sqlyp);
            } catch (Exception e) {
                
                e.printStackTrace();
            }  
             
             String str = "";
             for(wlpt_jy_yp con : Listyp){
                 str += "{ \"id\" : \"" + con.getId() + "\", \"name\" : \"" + URLEncoder.encode(con.getYp_name(), "UTF-8") + "\"},";
                 System.out.println(str);
             }
             
             if(str.endsWith(",")){
                 str = str.substring(0, str.length() - 1);
             }
             str = "[" + str + "]";
             response.getWriter().write(str);
             response.getWriter().close();
         }

这是报的错

org.springframework.web.bind.annotation.support.HandlerMethodInvocationException: Failed to invoke handler method [public void com.qdzq.wlpt.controller.admin.CydController.con(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.String,java.lang.String) throws java.sql.SQLException,java.io.IOException]; nested exception is java.lang.IllegalStateException: No parameter name specified for argument of type [java.lang.String], and no parameter name information found in class file either.
PHPz
PHPz

学习是最好的投资!

全部回复(1)
ringa_lee

java入参那里写
@RequestParam("name") String name,@RequestParam("id")String id

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号