SpringBeginer
Jun 13th, 2007, 10:43 AM
I have a situation where in there is an IFrame in my jsp which is used for displaying a list of customer objects containing name,age and address.
All the fields are textboxes wherein user can edit the data. Say for eg: if there are 5 customer in the IFrame, now user can edit any of the 15 textboxes,
My problem is : When user clicks on submit button on the parent jsp, I should populate the value changed in the IFrame along with the some other fields in the parent jsp.
I am able to populate the changed values if the customer list is in parent jsp. with this code :
<c:forEach var="customer" items="${backingBean.customerList}"
varStatus="loopStatus">
<tr>
<td>
<c:out value="${customer.name}" /> :<br>
<spring:bind
path="backingBean.customerList[${loopStatus.index}].name">
<input type="text" name="<c:out value="${status.expression}"/>"
value="<c:out value="${status.value}"/>" />
</spring:bind>
</td>
<td>
<c:out value="${customer.age}" /> :<br>
<spring:bind
path="backingBean.customerList[${loopStatus.index}].age">
<input type="text" name="<c:out value="${status.expression}"/>"
value="<c:out value="${status.value}"/>" />
</spring:bind>
</td>
</tr>
</c:forEach>
But, as iframe has a separate form and my parent jsp has a seperate separate form I am unable to do it.
If at all my iframe contains a single textbox i can populate the value by accessing the textbox in iframe through js as follows:
var fr=frames['iframe1'];
var frameForm;
if(fr && fr.document){
frameForm = fr.document.forms[0];
document.getElementById("frameValue").value = frameForm.elements["frameValue"].value;
}
But as this is a list population i am unable to do it...
Any possible way to populate the iframe value on click of submit button on my parent jsp
All the fields are textboxes wherein user can edit the data. Say for eg: if there are 5 customer in the IFrame, now user can edit any of the 15 textboxes,
My problem is : When user clicks on submit button on the parent jsp, I should populate the value changed in the IFrame along with the some other fields in the parent jsp.
I am able to populate the changed values if the customer list is in parent jsp. with this code :
<c:forEach var="customer" items="${backingBean.customerList}"
varStatus="loopStatus">
<tr>
<td>
<c:out value="${customer.name}" /> :<br>
<spring:bind
path="backingBean.customerList[${loopStatus.index}].name">
<input type="text" name="<c:out value="${status.expression}"/>"
value="<c:out value="${status.value}"/>" />
</spring:bind>
</td>
<td>
<c:out value="${customer.age}" /> :<br>
<spring:bind
path="backingBean.customerList[${loopStatus.index}].age">
<input type="text" name="<c:out value="${status.expression}"/>"
value="<c:out value="${status.value}"/>" />
</spring:bind>
</td>
</tr>
</c:forEach>
But, as iframe has a separate form and my parent jsp has a seperate separate form I am unable to do it.
If at all my iframe contains a single textbox i can populate the value by accessing the textbox in iframe through js as follows:
var fr=frames['iframe1'];
var frameForm;
if(fr && fr.document){
frameForm = fr.document.forms[0];
document.getElementById("frameValue").value = frameForm.elements["frameValue"].value;
}
But as this is a list population i am unable to do it...
Any possible way to populate the iframe value on click of submit button on my parent jsp