Author
Multiple Row Updation
subhasish nag
Ranch Hand
Joined: Apr 25, 2008
Posts: 101
I want to update multiple rows which will be upadated depending upon the chexbox selected.Kindly help me.Better if somebody can give some example.
Thanks,<br />Subhasish
Jimmy Clark
Ranch Hand
Joined: Apr 16, 2008
Posts: 2187
posted Dec 19, 2008 07:59:00
0
What "multiple rows" do you want to update?
subhasish nag
Ranch Hand
Joined: Apr 25, 2008
Posts: 101
In frontend (jsp)there will be some no of rows displaying datas of one table .I need some functionality so that user can update multiple rows of a jsp page by selecting checkboxes,which will also update the table.
Nishan Patel
Ranch Hand
Joined: Sep 07, 2008
Posts: 676
Hi, You can update multiple row like : For jsp code user map: <s:iterator value="auctionListingFeesList" status="rowstatus"> <s:hidden name="auctionListingFeesMap[%{id}].id" value="%{id}" /> <s:set name="classCSS" value="%{'Textfiled-no-border-odd'}" var="classCSS"></s:set> <s:set name="bgColor" value="%{'#FFFFFF'}" var="bgColor"></s:set> <s:if test="#rowstatus.even"> <s:set var="classCSS" value="%{'Textfiled-no-border-even'}"></s:set> <s:set var="bgColor" value="%{'#F8F8F8'}"></s:set> </s:if> <tr> <td align="center" class="verdana12Greybold right-border" bgcolor="<s roperty value="%{bgColor}" />"> <b><s roperty value="%{#rowstatus.index + 1}" /></b> </td> <td align="center" class="verdana12Greybold right-border" bgcolor="<s roperty value="%{bgColor}" />"> <s:textfield theme="simple" cssClass="%{classCSS}" name="auctionListingFeesMap[%{id}].startingPriceFrom" value="%{startingPriceFrom}" size="15" /> </td> <td align="center" class="verdana12Greybold right-border" bgcolor="<s roperty value="%{bgColor}" />"> <s:textfield theme="simple" cssClass="%{classCSS}" name="auctionListingFeesMap[%{id}].startingPriceTo" value="%{startingPriceTo}" size="15" /> </td> </tr> </s:iterator> For Java code Use private Map<Integer, AuctionListingFees> auctionListingFeesMap; AuctionListingFees - is your Hibernate DTO. generate getter and setter method for it. this.miscellaneousFees = MiscellaneousFeesServiceDelegator.getMiscellaneousFees(); this.auctionListingFeesMap = new HashMap <Integer, AuctionListingFees>(); this.auctionListingFeesList = AuctionListingFeesServiceDelegator.getAuctionListingFees(); for (AuctionListingFees auctionListingFee : this.auctionListingFeesList) { this.auctionListingFeesMap.put(auctionListingFee.getId(), auctionListingFee); } For update user this code. MiscellaneousFees tmpMiscellaneousFees = MiscellaneousFeesServiceDelegator.getMiscellaneousFees(); this.miscellaneousFees.setFeaturedShopFee(tmpMiscellaneousFees.getFeaturedShopFee()); this.miscellaneousFees.setSearchEngineMonthlyFees(tmpMiscellaneousFees.getSearchEngineMonthlyFees()); MiscellaneousFeesServiceDelegator.updateMiscellaneousFees(this.miscellaneousFees);
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer ,My Blog
subject: Multiple Row Updation