异常:org.springframework.web.bind.MissingServletRequestParameterException:所需的字符串参数“ params”不存在 [英] Exception: org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'params' is not present

查看:2284
本文介绍了异常:org.springframework.web.bind.MissingServletRequestParameterException:所需的字符串参数“ params”不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击编辑按钮时,dataTable中的值应以表格形式显示。但不知何故,它不起作用。以下是我的参考代码。

When i clicked the edit button the values from dataTable should display in form. But somehow it doesn't work. Below are my codes for reference.

调用数据表:

$("#tranTable").on("click", "#edit", function(){
    var row = $(this).closest("tr");

    $("#Own-Account").removeClass("hidden");
    $("fieldset#addToListMethod").addClass("hidden");
    $("fieldset#Own-Account #templateTrxId").val( row.find("[name$=templateTrxId]").val() )
    $("fieldset#Own-Account #templateId")   .val( row.find("[name$=templateId]").val() )
    $("fieldset#newFT #fromAccNo")          .val( row.find("[name$=fromAccNo]").val() ), 
    $("fieldset#newFT #methodOfTransfer")   .val( row.find("[name$=methodOfTransfer]").val() ), 
    $("fieldset#Own-Account #toAccNo")      .val( row.find("[name$=toAccNo]").val() ), 
    $("fieldset#Own-Account #paymentRef")   .val( row.find("[name$=paymentRef]").val() ),
    $("fieldset#Own-Account #amount")       .val( row.find("[name$=amount]").val() ),

    //hidden
    $("fieldset#Own-Account #otherPaymentDetail").val( row.find("[name$=otherPaymentDetail]").val() ),
    $("fieldset#Own-Account #email1").val( row.find("[name$=email1]").val() ),          
    $("fieldset#Own-Account #email2").val( row.find("[name$=email2]").val() ),
    $("fieldset#Own-Account #sms1").val( row.find("[name$=sms1]").val() ),
    $("fieldset#Own-Account #sms2").val( row.find("[name$=sms2]").val() ),
    $("fieldset#Own-Account #purpose").val( row.find("[name$=purpose]").val() )
    $("fieldset#Own-Account #isEdit").val(1);
    $("fieldset#Own-Account #dataTableRowId").val(row.data("row-id"));


});


推荐答案

从例外情况来看,您的问题可能是由于 @RequestMapping 找不到从上一页发送的参数。

From the exception, your problem likely occurs because the @RequestMapping doesn't find the parameter being sent from previous the page.

在这种情况下,可能是这样的:

In this case, it is likely like this:

@RequestMapping(value = "/check")
public String getID(@RequestParam(value = "params") String params){
//your logic code here
}

在这里,当 @RequestMapping 找不到参数

@RequestParam(value = "params") String params

这是因为默认情况下, @RequestParam 尝试获取值。

This happens because, by default, @RequestParam tries to get the value. It then returns an exception when the value is not found.

因此,您有两种方法可以解决此问题,

So you have two ways to resolve this,


  1. 您可以为URL / check 提供一个 params 变量,或者

您可以将 @RequestParam 的要求改为false:

You can change the @RequestParam requirement to false like this:

@RequestParam(value = params,required = false)字符串参数

@RequestParam(value = "params", required = false) String params

请注意,这是一个示例反映您的情况和问题。古德·卢克。

Take note that this is an example to reflect your scenario and problem. Gud luk.

这篇关于异常:org.springframework.web.bind.MissingServletRequestParameterException:所需的字符串参数“ params”不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆