0
我有一個單獨的jsp,其中有兩個彈簧形式可用。單按鈕彈簧多形式到單動
<form:form modelAttribute="obj1" action="/some">
here i get the list of values and show then in dropdown.
</form:form>
<form:form modelAttribute="obj2" action="/some">
here i have some other things like table etc and **a submit button**.
</form:form>
obj1和obj2都是模型對象,並通過兩次數據庫調用來填充。
@RequestMapping("some")
public ModelAndView somemethod(){
return "modelandview";
}
現在,我如何檢索提交按鈕按下時,下拉選擇此控制器操作的值。現在,我可以從另一個表單獲取數據(例如obj2表單)。也許,我不能在另一個表單選項中使用表單,但如果這只是選項,我會繼續前進,然後再試一次。一個
把一切都放在一個表單中? –
但他們的模型屬性是不同的,我怎麼能在這種情況下? – rakeeee
將它們綁定到同一個Model對象。如有必要,在兩個現有模型對象上創建一個包裝,並將各個字段綁定到這些嵌套屬性,例如obj1.abc,obj2.xyz –