Spring MVC: mapping multiple nested properties -


i new spring mvc, excuse me if has been answered before

i have following request data.test=test&data.rating=4&data.comments=test model object is

class resp {    data data; } class data {     string test;     string rating;     string comments; } 

i using @modelattribute , every thing working fine.

my problem properties of data class variable. both number of properties , names of properties dynamic, change @ runtime. tried different approaches creating setdata(map<string, string) in resp class. nothing helped.

thanks in advance

update: sorry forgot mention earlier, or bad, using domain objects jpa entities

you can take hashmap request or response in spring mvc. change instead of getting paramname field in object , key in map. works map in response

  @requestmapping(value = "/testurl", method = requestmethod.post) public @responsebody map<string,string> test(         @requestbody map<string,string> requestmap) { 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -