You need to sign in to do that
Don't have an account?

How to display object field from different class on visualforce page
Hi,
I have a class which contains list of custom class objects (list of different class object which I created). Now I want to show this list of objects on visualforce page and I need access to every field of this list of class object. How I can do that ?
Please find below code snippest for better understanding of the problem.
Apex Classes :
1) ShipmentHistoryRecord (Class whose data I want to show on visualforce page)
2) ShipmentHistory
3) Visualforce page code sample :
Thanks,
Abhishek
I have a class which contains list of custom class objects (list of different class object which I created). Now I want to show this list of objects on visualforce page and I need access to every field of this list of class object. How I can do that ?
Please find below code snippest for better understanding of the problem.
Apex Classes :
1) ShipmentHistoryRecord (Class whose data I want to show on visualforce page)
public with sharing class ShipmentHistoryRecord { public String businessContact; public String techContact; List<Product> products; // Constructor public ShipmentHistoryRecord(String businessContact, String techContact,List<Product> products) { this.businessContact = businessContact; this.techContact = techContact; this.products = products.clone(); } public class Product { public String productName; public String version; } }
2) ShipmentHistory
public with sharing class ShipmentHistory { public List<ShipmentHistoryRecord> shipmentHistoryTest{get;set;} public ShipmentHistory(ApexPages.StandardController controller) { shipmentHistoryTest = new List<ShipmentHistoryRecord>(); getShipmentHistory(<"sending some JSON string which is valid and works for below code">); } public void getShipmentHistory(String jsonStr) { // Parse entire JSON response. JSONParser parser = JSON.createParser(jsonStr); while (parser.nextToken() != null) { if (parser.getCurrentToken() == JSONToken.START_ARRAY) { while (parser.nextToken() != null) { if (parser.getCurrentToken() == JSONToken.START_OBJECT) { ShipmentHistoryRecord history =(ShipmentHistoryRecord)parser.readValueAs(ShipmentHistoryRecord.class); String s = JSON.serialize(history); system.debug('JSONParser:getShipmentHistory: Shipment History : ' + s); shipmentHistoryTest.add(history); parser.skipChildren(); } } } } }
3) Visualforce page code sample :
<apex:page standardController="Opportunity" extensions="ShipmentHistory"> . . . <apex:repeat value="{!shipmentHistoryTest}" var="history"> <apex:outputText title="Product" value="{!history.businessContact}"></apex:outputText> </apex:repeat>
Thanks,
Abhishek

Define multiple extensions like

I tried that and it did not work.