Hi guys, I am working on Spring - 3.0 using REST architecture.I am
facing a problem while using
<form:input tag inside <c:forEach .
I have a array list of quotations containing quotation object. That
quotation list is inside quotationSheetView object. I want to set some
properties of that quotation object using user input on GUI. So i
iterate the list first and then provide <form:input to that user input
fields.
for e.g.
<c:forEach items="${quotationSheetView.quotations}" var="quotation"
varStatus="row">
<tr>
<td width="5%"><form:input id="quotations[$
{row.index}].marginPercentage" path="quotations[$
{row.index}].marginPercentage" cssClass="flat_fields" /></td>
</tr>
</c:forEach>
Now the problem is after using this we have first a preview
functionality which user can see what values he had set and on preview
page we provide save.My controller code when user clicks preview
button is
Controller code for preview page:
@RequestMapping(value = "quotationSheet/preview.htm", method =
RequestMethod.POST)
public String preview(@ModelAttribute QuotationSheetView
quotationSheetView, BindingResult result, SessionStatus status) throws
Exception
{
for(Quotation quotation: quotationSheetView.getQuotations()){
logger.info("Margin
%="+quotation.getMarginPercentage());
}
return "costSheet/QuotationSheetPreview.jsp";
}
The problem is that on preview page all the values that i had supplied
in input box goes blank.
Now how to tackle this can anyone help me for that ??
If i use simple
<input type="text" name="quotations[${row.index}].marginPercentage"
value="<c:out value='$
{quotationSheetView.quotations[row.index].marginPercentage}'/>"
class="flat_fields" />
then i m getting the value at controller as well as on preview page.
Can anyone help me how to achieve this using <form:input tag.
If i don't use <c:foreach and supply some property using <form:input
then i can get this value on preview page but don't know inside
<c:foreach why its not working .
--
You received this message because you are subscribed to the Google
Groups "open-training-community" group.
To post to this group, send email to
open-traini...@googlegroups.com
To unsubscribe from this group, send email to
open-training-com...@googlegroups.com
For more options, visit this group at
http://groups.google.co.in/group/open-training-community?hl=en-GB