Home » Javascript » How to solute the exception:POST http://localhost:8082/safety-portal/inspection/search 400 ()

How to solute the exception:POST http://localhost:8082/safety-portal/inspection/search 400 ()

Posted by: admin October 29, 2018 Leave a comment

Questions:

I get an exception:
POST http://localhost:8082/safety-portal/inspection/search 400 ()

I search the solution everywhere and can not get the answer.I hava had no idea for it,so please help me,gentleman!

framework:SSM–>spring+springmvc+mybatis

web.xml

<!-- 2、SpringMVC Front Controller -->
      <servlet>
            <servlet-name>safety-portal</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>classpath:spring/springmvc.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>safety-portal</servlet-name>
            <!-- pseudo static -->
            <url-pattern>*.html</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>safety-portal</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>

controller

@Controller
@RequestMapping("/inspection")
public class JointInspectionController {
    @Autowired
    private JointInspectionService jointInspectionService;
        @RequestMapping(value = "/search" , method = RequestMethod.POST)
    @ResponseBody
    private EasyUIDataGridResult searchInspectionList(Date StartInspectionDate 
            , Date endInspectionDate , String inspectionSet , String inspectionResult 
            , String inspectionDuty) throws ParseException {
        System.out.println("before-------------service--------------result------------");
        EasyUIDataGridResult result = jointInspectionService.searchInspectionList(StartInspectionDate
                                        , endInspectionDate, inspectionSet, inspectionResult, inspectionDuty);
        System.out.println(result + "-------------controller--------------result------------");
        return result;
    }
}

jsp

<body class="easyui-layout">
    <table class="easyui-datagrid" id="inspectionList" title="检查项目信息"
        data-options="singleSelect:false,collapsible:true,pagination:true,pageSize:20"
        toolbar="#tb_InspectionList">
        <thead>
            <tr>
                <th data-options="field:'inspectionId',width:150,align:'center'">项目编号</th>
                <th
                    data-options="field:'inspectionDate',width:100,align:'center',formatter:SAFETY.formatDate">检查日期</th>
                <th data-options="field:'inspectionSet',width:60,align:'center'">机组</th>
                <th data-options="field:'inspectionIssue',width:360,align:'center'">检查问题</th>
                <th data-options="field:'inspectionDuty',width:50,align:'center'">负责人</th>
                <th
                    data-options="field:'inspectionEnddate',width:100,align:'center',formatter:SAFETY.formatDate">整改时限</th>
                <th data-options="field:'inspectionResult',width:60,align:'center'">整改结果</th>
                <th
                    data-options="field:'inspectionReviewperson',width:50,align:'center'">复查人</th>
                <th
                    data-options="field:'insepctionReviewresult',width:60,align:'center'">复查结果</th>
            </tr>
        </thead>
    </table>

    <div id="inspectionSearchWindow" class="easyui-window" title="查询问题信息"
        data-options="modal:true,closed:true,iconCls:'icon-save',href:'${pageContext.request.contextPath}/inspection-search.html'"
        style="width:80%;height:100%;padding:10px;"></div>

    <div id="tb_InspectionList" style="padding:5px;height:auto">
        <div>
            <form action="" method="post" id="searchInspectionInformation">
                <table>
                    <tr>
                        <td>开始日期:</td>
                        <td><input class="easyui-datebox" name="StartInspectionDate"
                            data-options="editable:false" style="width: 100px;" /></td>
                        <td>结束日期:</td>
                        <td><input class="easyui-datebox" name="endInspectionDate"
                            data-options="editable:false" style="width: 100px;" /></td>
                        <td>机组:</td>
                        <td><select class="easyui-combobox" name="inspectionSet"
                            data-options="editable:false" style="width: 60px;">
                                <option value="" selected="selected">全部</option>
                                <option value="DCL">DCL</option>
                                <option value="RAF">RAF</option>
                                <option value="FCL">FCL</option>
                        </select></td>
                        <td>完成情况:</td>
                        <td><select class="easyui-combobox" name="inspectionResult"
                            data-options="editable:false" style="width: 80px;">
                                <option value="" selected="selected">全部</option>
                                <option value="未完成">未完成</option>
                                <option value="完成">完成</option>
                        </select></td>
                        <td><input class="easyui-searchbox" type="text"
                            name="inspectionDuty" data-options="validType:'length[0,3]'"
                            style="width: 100px;" maxlength="3" prompt="负责人" /></td>
                        <td><a href="#" class="easyui-linkbutton"
                            iconCls="icon-search" onclick="searchInspectionInformation()">搜索</a></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>

    <div style="padding:5px">
        <a href="javascript:void(0)" class="easyui-linkbutton"
            onclick="quitForm()">退出</a>
    </div>
</div>
    <script>
        function codeAddress() {
            if(${data} != '') {
                    //回显数据
                    $("#inspectionList").datagrid("loadData",${data});
                    } else {
                        $.messager.alert('提示','没有检查信息!','info',function(){
                            window.location.replace("${pageContext.request.contextPath}");
                        });
                    }
        }

        function searchInspectionInformation() {
            $("#inspectionSearchWindow").window({
                onLoad : function() {
                alert($("#searchInspectionInformation").serialize());
                    $.post("${pageContext.request.contextPath}/inspection/search",$("#searchInspectionInformation").serialize(),function(data) {
                        if(data != null) {
                        //回显数据
                        $("#inspectionSearchList").datagrid("loadData",data);
                    } else {
                        $.messager.alert('提示','没有检查信息!','info',function(){
                            $("#inspectionSearchWindow").window('close');
                        });
                    }
                    });
                }
            }).window("open");
        }

        function quitForm() {
            $.messager.alert('提示', '确定退出吗?', 'info', function() {
                window.location.replace("${pageContext.request.contextPath}");
            });
        }
        window.onload = codeAddress;
    </script>
</body>

alert($(“#searchInspectionInformation”).serialize());–>result
enter image description here

Answers: