Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple Row Updation

 
subhasish nag
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What "multiple rows" do you want to update?
 
subhasish nag
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic