2
私のメソッドには3つのリクエストパラメータがあり、HTTP POSTリクエストボディには3つのパラメータすべてがあります。availableCostTypesReturn,selectedCostTypesReturn and costTypeProgramId
このメソッドだけが呼び出されます。今Spring MVCマップメソッドでrequestparamがポストに存在しないときに呼び出されない
成功したPOSTリクエストのボディ
availableCostTypesReturn=1&availableCostTypesReturn=2&availableCostTypesReturn=3&
availableCostTypesReturn=4&selectedCostTypesReturn=5&costTypeProgramId=53
私のPOSTリクエストのボディが変更された場合
availableCostTypesReturn=1&availableCostTypesReturn=2&availableCostTypesReturn=3&
availableCostTypesReturn=4&availableCostTypesReturn=5&costTypeProgramId=53
に、このメソッドが呼び出さ取得されていません。
@RequestMapping(value = "/costTypes", method = RequestMethod.POST)
public String updateCostType(
Model model,
@RequestParam(value="availableCostTypesReturn")
String[] availableCostTypesReturn,
@RequestParam(value="selectedCostTypesReturn")
String[] selectedCostTypesReturn,
@RequestParam(value="costTypeProgramId")
int costTypeProgramId
)
一つだけavailableCostTypesReturn、selectedCostTypesReturnパラメータのが存在するときのシナリオがあります。
私のメソッドシグネチャをthisに変更しました どうすれば同じ方法を使用できますか?私はSpring MVCの3.0.xのに
を使用しています
は答えは1として私の注釈署名を修正トマシュNurkiewiczから
@RequestParam(value="availableCostTypesReturn", defaultValue= "", required = false)