I have a spring form that has a helper object. The form is as follows:
<sf:form cssClass="form-horizontal" commandName="campaignModel" method="post"> <sf:input path="campaign.name" class="form-control" /> <sf:input path="landingPageModels.landingPage.url" class="form-control" /> </sf:form>
Model class (form support object) -
CampaignModel.java
public class CampaignModel { private Campaign campaign = new CampaignImpl(); private List<LandingPageModel> landingPageModels = new Arraylist<LandingPageModel>; public Campaign getCampaign() { return campaign; } public void setCampaign(Campaign campaign) { this.campaign = campaign; } public List<LandingPageModel> getLandingPageModels() { return landingPageModels; } public void setLandingPageModels(List<LandingPageModel> landingPageModels) { this.landingPageModels = landingPageModels; }
LandingPageModel.java -
public class LandingPageModel { private LandingPage landingPage = new LandingPageImpl(); private List<LandingPageParameterImpl> landingPageParameters = new ArrayList<LandingPageParameterImpl>(); public LandingPage getLandingPage() { return landingPage; } public void setLandingPage(LandingPage landingPage) { this.landingPage = landingPage; } public List<LandingPageParameterImpl> getLandingPageParameters() { return landingPageParameters; } public void setLandingPageParameters(List<LandingPageParameterImpl> landingPageParameters) { this.landingPageParameters = landingPageParameters; } }
LandingPage.java -
public class LandingPageImpl extends EntityImpl implements LandingPage { private String url; public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } }
So, I want so that I can insert a lot of landPage objects (having their own url property) into the landingPageModels object. This means that I can have a mulitple input tag with a url property like this -
<sf:input path="landingPageModels.landingPage.url" class="form-control" /> <sf:input path="landingPageModels.landingPage.url" class="form-control" /> <sf:input path="landingPageModels.landingPage.url" class="form-control" />
But when executing this code, spring gives me an error that the landingPage property for landPageModels does not have a set getter method. How to solve it and how to make this value somewhat?
source share