This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes Adding new row kept previous row values. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Adding new row kept previous row values." Watch "Adding new row kept previous row values." New topic
Author

Adding new row kept previous row values.

john smiths
Greenhorn

Joined: Feb 19, 2012
Posts: 3
Hi All:


I needed your help when you have time!!
I am using JSF 1.1, facelets,Icefaces 1.82 and Weblogic, Internet Explorer or Google Chrome.
Any help, suggestion or hint would be greatly appreciated it!!
When I click on "Add Row" it adds a new row but it keep the values of the previous row. Do you get the same problem?
I have this problem testing on "Internet Explorer 9, Google Chrome and Firefox 11". The new row with the previous row values seemed to disappear if I click the browser's refresh button.


Java source:
public String addRow()
{
List<ShipmentDetailsBB> shipmentDetailsList = this.opportunitiesBB.getShipmentDetailsList();
ShipmentDetailsBB shipmentDetails = new ShipmentDetailsBB();
int uiID = shipmentDetailsList.size() + 1;
shipmentDetails.setUiId(Integer.toString(uiID));
List<NameValueObject> nameValueObjectList = new ArrayList<NameValueObject>();
shipmentDetails.setSelectedDimensionType("inches");
NameValueObject nameValueObject1 = new NameValueObject();
nameValueObject1.setCode("inches");
nameValueObject1.setTitle("inches");
nameValueObjectList.add(nameValueObject1);
NameValueObject nameValueObject2 = new NameValueObject();
nameValueObject2.setCode("cms");
nameValueObject2.setTitle("cms");
nameValueObjectList.add(nameValueObject2);
shipmentDetails.setDimensionTypeList(Utility.ConvertNVListToSelectItem(nameValueObjectList));
shipmentDetailsList.add(shipmentDetails);
opportunitiesBB.setShipmentDetailsList(shipmentDetailsList);

return "success";
}

The source of the jspx file. The UI namespace is for Facelets. I get the same problem even if I change the "<ice:inputText>" to "<h:inputText>".
<ui:repeat value="#{opportunitiesBean.opportunitiesBB.shipmentDetailsList}" var="shipmentDetail">

<tr>
<td>

<ice:selectBooleanCheckbox value="#{shipmentDetail.select}" id="select" readonly="false" disabled="false" />

</td>
<td>

<ice:inputText id="bookedweight" value="#{shipmentDetail.bookWeight}" size="8" />
</td>
<td>
<input type="hidden" name="opp_detail_id[]" value=""/>
</td>
<td>

<ice:inputText id="numberOfPieces" value="#{shipmentDetail.numberOfPieces}" size="5" />
</td>
<td>L
<ice:inputText id="length" value="#{shipmentDetail.length}" size="3" />
x W <ice:inputText id="width" value="#{shipmentDetail.width}" size="3" />
x H <ice:inputText id="height" value="#{shipmentDetail.height}" size="3" />
  

<ice:selectOneMenu id="dimensionType" value="#{shipmentDetail.selectedDimensionType}">
<f:selectItems value="#{shipmentDetail.dimensionTypeList}"/>
</ice:selectOneMenu>
</td>
<td>
<ice:inputText id="uldLocation" value="#{shipmentDetail.uldLocation}" />
</td>
</tr>
</ui:repeat>

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958
    
  19

You can make it easier on us if you make the code easier to read: http://www.coderanch.com/how-to/java/UseCodeTags

JSPX should not be used in JSF2, though. Your View Template should be an xhtml file, not a JSP file.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Adding new row kept previous row values.
 
Similar Threads
Problem in Icefaces Input binding attribute
struts 2 + dynamic input + showing said input
Multiple file upload not working
HOW TO REFRESH THE FULL PAGE USING JSF ICE FACES AND TO GET THE UPDATED RECORDS INTO PAGE
ice:inputText not accepting values until tab out or mouse click