You need to sign in to do that
Don't have an account?
Sami Shakith
how to display values of list in vf page ?
Hi,
I want to display values on vf page which is stored in list. I have used <apex:datatable> to display those values. But it is not displaying any values on vf page.In that list contains json deserialized response.I am getting the response, i'm able get the individual values also. It shows in the debug logs, but not displaying in the vf page.
I want to display values on vf page which is stored in list. I have used <apex:datatable> to display those values. But it is not displaying any values on vf page.In that list contains json deserialized response.I am getting the response, i'm able get the individual values also. It shows in the debug logs, but not displaying in the vf page.
<apex:page Controller="CanvasController" action="{!requestM}" sidebar="false"> <!--{!response}--> <apex:pageBlock> <apex:pageblockSection > <apex:dataTable value="{!dr}" var="d"> <apex:column headerValue="Item id"><apex:outputText value="{!d.ItemId}"/></apex:column> <apex:column headerValue="Name"><apex:outputText value="{!d.name}"/></apex:column> <apex:column headerValue="upc"><apex:outputText value="{!d.Upc}"/></apex:column> </apex:dataTable> </apex:pageblockSection> </apex:pageBlock> </apex:page>
global class CanvasController{ public Integer ItemId{get;set;} public String name{get;set;} public List<Items> dr{get;set;} public CanvasController(){ } public void requestM(){ String url = 'http://api.walmartlabs.com/v1/feeds/specialbuy?apikey=5amzkrmy235zddjwmu785hf8&categoryId=3944'; HttpRequest req = new HttpRequest(); req.setEndpoint(url); req.setMethod('GET'); Http http = new Http(); HttpResponse res = http.send(req); String responseBody = res.getBody(); system.debug('statuscode: ' + res.getStatusCode()); //system.debug('Response : ' + responseBody); ResCls resItem = (ResCls)JSON.deserialize(responseBody, ResCls.class); system.debug('Response after deserialization: ' + resItem); system.debug('Response Items: ' + resItem.items); List<Items> rl = resItem.items; List<Items> dr = new List<Items>(); for(Items it:rl){ system.debug('Item Name: ' + it); ItemId = it.ItemId; name = it.Name; system.debug('ItemId: ' + it.ItemId); system.debug('Name: ' + it.Name); dr.add(it); } system.debug('List: ' + dr); } public class ResCls{ List<Items> items; } public class Items{ public Integer ItemId{get;set;} public Integer ParentItemId{get;set;} public String Name{get;set;} public Double SalePrice{get;set;} public String Upc{get;set;} public String CategoryPath{get;set;} public Boolean AvailableOnline{get;set;} public String ShortDescription{get;set;} public String LongDescription{get;set;} public String BrandName{get;set;} public String ThumbnailImage{get;set;} public String LargeImage{get;set;} public String ProductTrackingUrl{get;set;} public Boolean FreeShipping{get;set;} public Boolean NinetySevenCentShipping{get;set;} public Double StandardShipRate{get;set;} public Double TwoThreeDayShippingRate{get;set;} public Double OvernightShippingRate{get;set;} public String Size{get;set;} public String Color{get;set;} public Boolean Marketplace{get;set;} public Boolean ShipToStore{get;set;} public Boolean FreeShipToStore{get;set;} public String ModelNumber{get;set;} public String SellerInfo{get;set;} public String ProductUrl{get;set;} public List<Integer> Variants{get;set;} public List<String> Shelves{get;set;} public String CustomerRating{get;set;} public String CustomerRatingImage{get;set;} public Integer NumReviews{get;set;} //public Item.BestMarketPlacePrice BestMarketplacePrice{get;set;} public String CategoryNode{get;set;} public Boolean isRollBack{get;set;} public Boolean isSpecialBuy{get;set;} public String Isbn{get;set;} public Boolean Bundle{get;set;} public Boolean Clearance{get;set;} public Boolean PreOrder{get;set;} public String PreOrderShipsOn{get;set;} public String Stoc{get;set;} public Boolean Freight{get;set;} public Long DealEndTime{get;set;} public Long DealStartTime{get;set;} //public Item.Attributes Attributes{get;set;} public String Gender{get;set;} public String Age{get;set;} } }
Change the line 29 of your code to the following
All Answers
Change the line 29 of your code to the following