Command Objects in Spring

前端 未结 2 758
一整个雨季
一整个雨季 2021-01-02 17:20

I have a command object composed of primitive fields and an object field. How do I bind my form fields to the fields in the object?

I tried doing this but to no ava

2条回答
  •  自闭症患者
    2021-01-02 17:48

    Two possible issues here:

    1. activity.activity is invalid (unless your getters do not correspond to your member variables) because Course.activity is a list. You need to address a particular list element - e.g. activity[0].activity. You'll also have to make sure it actually exists.

    2. Have you configured your FormController correctly? Does it pass Course instance to view as it should? Take a look at Spring MVC tutorial for an example.

    If after you've fixed #1 and verified that #2 is done correctly the error doesn't go away, please post more details (FormController mapping / source).

提交回复
热议问题