tdhaayushverma
Jun 17th, 2008, 02:26 PM
I have a JSP in which a new row can be added dynamically. I mean a user can add another row ( I am using Java script to get a new row).
Here is a snippet of my JSP:
<tr>
<td class="label">URL</td>
<td>
<div class="useError">
<spring:nestedPath path="commandPollBean.urls">
<spring:bind path="url">
<div>
<input name="url" type="radio" value="" />
<input name="url" type="text" value="Enter Poll URL" size="40" />
</div>
<div style="padding:8px 0 8px 100px;">- Or -</div>
<div><input name="url" type="radio" value="" />
<select><option>http://superlong.espn.com/poll/NFL</option>
<option>http://superlong.espn.com/poll/NBA</option>
<option>http://superlong.espn.com/poll/MLB</option></select>
</div>
<c:forEach items="${status.errorMessages}" var="errorMessage" >
<c:out value="${errorMessage}" /></br>
</c:forEach>
</spring:bind>
</spring:nestedPath>
</div>
</td>
<td class="sm"></td>
</tr>
<tr id="urlRow">
<td class="buttons centerme" colspan="3" id="add">
<span class="buttons centerme" id="addURLB1">
<a href="javascript:addURL('pollTable','urlRow', '1');">
Add Another URL
</a>
</span>
</td>
</tr>
And my form bean is:
public class PollForm implements Serializable {
private List<Url> urls = new ArrayList<Url>();
// getter and setters
And the list of type Url and the Url class is as follows:
public class Url implements Serializable {
private Integer urlID;
private String url;
// getter and setters
And I am using a SimpleFormcontroller
// constructor
public PollsController() {
super();
logger.info("PollsController constructor");
setSupportedMethods(new String[] { METHOD_GET, METHOD_POST });
setSessionForm(true);
setCommandName("commandPollBean");
setCommandClass(PollForm.class);
setFormView("CreatePoll");
// setSuccessView("Welcome");
}
But as i submit the form I get an error:
org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'urls.url' of bean class [com.wdig.polls.webapp.webform.PollForm]: Bean property 'urls.url' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
Any pointers plz..
Thanks.
Here is a snippet of my JSP:
<tr>
<td class="label">URL</td>
<td>
<div class="useError">
<spring:nestedPath path="commandPollBean.urls">
<spring:bind path="url">
<div>
<input name="url" type="radio" value="" />
<input name="url" type="text" value="Enter Poll URL" size="40" />
</div>
<div style="padding:8px 0 8px 100px;">- Or -</div>
<div><input name="url" type="radio" value="" />
<select><option>http://superlong.espn.com/poll/NFL</option>
<option>http://superlong.espn.com/poll/NBA</option>
<option>http://superlong.espn.com/poll/MLB</option></select>
</div>
<c:forEach items="${status.errorMessages}" var="errorMessage" >
<c:out value="${errorMessage}" /></br>
</c:forEach>
</spring:bind>
</spring:nestedPath>
</div>
</td>
<td class="sm"></td>
</tr>
<tr id="urlRow">
<td class="buttons centerme" colspan="3" id="add">
<span class="buttons centerme" id="addURLB1">
<a href="javascript:addURL('pollTable','urlRow', '1');">
Add Another URL
</a>
</span>
</td>
</tr>
And my form bean is:
public class PollForm implements Serializable {
private List<Url> urls = new ArrayList<Url>();
// getter and setters
And the list of type Url and the Url class is as follows:
public class Url implements Serializable {
private Integer urlID;
private String url;
// getter and setters
And I am using a SimpleFormcontroller
// constructor
public PollsController() {
super();
logger.info("PollsController constructor");
setSupportedMethods(new String[] { METHOD_GET, METHOD_POST });
setSessionForm(true);
setCommandName("commandPollBean");
setCommandClass(PollForm.class);
setFormView("CreatePoll");
// setSuccessView("Welcome");
}
But as i submit the form I get an error:
org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'urls.url' of bean class [com.wdig.polls.webapp.webform.PollForm]: Bean property 'urls.url' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
Any pointers plz..
Thanks.