Reputation: 93
I want to set to different data,like
SoyMapData dataFormsMenu=new SoyMapData(
"class","menu horizontal",
"caption","",
"id","dfMenu",
"innerContainer","div",
"helper","span",
"items",new SoyListData(
new SoyMapData ("caption", "Manage Dataforms",
"class", "",
"link", "#"),
new SoyMapData("caption", "viewForm",
"class", "",
"link", "#")
));
SoyMapData mainMenu = new SoyMapData(
"class","menu horizontal dropdown",
"caption","",
"id","mainMenu",
"container","div",
"contClass","navigation main left",
"items",captionData);
into model object of spring,
model.addattribute("",mainmenu);
model.addattribute("",dfmenu);
how to do this in spring.
Upvotes: 1
Views: 2291
Reputation: 298898
a) you are not talking about Spring, you are talking about Spring MVC, the MVC framework built upon the Spring framework. There's a difference.
b) you need to give the model attribute a name, e.g.
model.addattribute("main",mainmenu);
model.addattribute("df",dfmenu);
Then you can access the data from a JSP (or other view) using
${main.id}
or ${main[id]}
,
depending on the inner workings of SoyMapData
Upvotes: 3
Reputation: 4547
create a bean for all simple objects; then connect them to get your complex object. For example, create a bean for each simple SoyMapData objects (one for "Manage Dataform, one for ""viewForm" ...), then use them to get dataFormsMenu bean object by setting property/via constructor
Upvotes: 0