Reply
Super Contributor
paul-lmi
Posts: 894
0
Accepted Solution

Weird system output when pulling a list of objects into a VF page

I'm using a WebServiceCallout to pull back a list of objects, and in turn writing those to another list of objects.  When I try to pull that second list into a VF page via an apex:repeat, I get

 

core.apexpages.el.adapters.ApexObjectValueELAdapter@12fe69f
core.apexpages.el.adapters.ApexObjectValueELAdapter@1cdf01b
core.apexpages.el.adapters.ApexObjectValueELAdapter@14e86c5
core.apexpages.el.adapters.ApexObjectValueELAdapter@720ada
core.apexpages.el.adapters.ApexObjectValueELAdapter@1268a22
core.apexpages.el.adapters.ApexObjectValueELAdapter@136fc51
core.apexpages.el.adapters.ApexObjectValueELAdapter@ef537e
core.apexpages.el.adapters.ApexObjectValueELAdapter@52af1e
core.apexpages.el.adapters.ApexObjectValueELAdapter@67142e
core.apexpages.el.adapters.ApexObjectValueELAdapter@15dfb17

 

Here are the applicable code snippets:

 

Class to store doc properties

 

Public Class doc { Public String docid; Public String link; Public String title; Public String viewRank; Public String voteRank; }

 

 

 

 Method to return a list of "doc" (this works absolutely as expected)

 

/* this method will execute a doc search and return a list of docs */ Public InstranetIntegration.doc[] search(String keywords, string doctype, string product, string langcode){ String sessioncookie = InstranetIntegration.login('test','test'); /* first we need to create the empty query */ InstranetKB.DocumentSearchQuery query = new InstranetKB.DocumentSearchQuery(); /* now we create the categories for the query */ InstranetKB.ArrayOfCategorySelection catgroup = new InstranetKb.ArrayOfCategorySelection(); InstranetKB.CategorySelection[] cats = new InstranetKB.CategorySelection[]{}; InstranetKB.CategorySelection cat = new InstranetKB.CategorySelection(); cat.categoryGroupName = 'ProductAndOfferings'; cat.categoryName = product; InstranetKB.CategorySelection cat1 = new InstranetKB.CategorySelection(); cat1.categoryGroupName = 'TypeOfDocuments'; cat1.categoryName = docType; InstranetKB.CategorySelection cat2 = new InstranetKB.CategorySelection(); cat2.categoryGroupName = 'Language'; cat2.categoryName = langcode; cats.add(cat); cats.add(cat1); cats.add(cat2); /* add the categories list to the array class */ catGroup.CategorySelection = cats; /* add teh categories list to the query */ query.categorySelections = catGroup; query.keywords = keywords; /* set up the sorting options */ InstranetKB.DocumentSort sorting = new InstranetKB.DocumentSort(); sorting.documentSortType = 'Relevance'; sorting.documentSortOrder = 'Descending'; /* create the list filter */ InstranetService.ListFilter filter = new InstranetService.ListFilter(); filter.maxNumberOfItems = 10; filter.startIndex = 1; /* define the type of search */ String searchType = 'DocumentPush'; /* finally, execute the search */ InstranetKB.KnowledgeBaseServiceHttpPort req = new InstranetKB.KnowledgeBaseServiceHttpPort(); req.inputHttpHeaders_x = new Map<string,string>(); req.inputHttpHeaders_x.put('Cookie', sessioncookie); InstranetKB.DocumentSearchResult results = req.searchDocuments(query,sorting,filter,searchType); system.debug('Search results: ' + results); system.debug('Search Result Count: ' + results.resultCount); /* process the results */ InstranetKB.ArrayOfDocumentSearchResultItem res = results.documentSearchResultItems; InstranetKB.DocumentSearchResultItem[] items = res.DocumentSearchResultItem; Integer ctr = 1; system.debug('\n'); List<InstranetIntegration.doc> docList = new InstranetIntegration.doc[]{}; if(items.size() > 0){ for (InstranetKB.DocumentSearchResultItem i : items){ //system.debug(LoggingLevel.INFO,'Document title ' + i.documentProperties.title); //system.debug(LoggingLevel.INFO,'Rankings - View: ' + i.documentProperties.viewRank + ' Vote: ' + i.documentProperties.voteRank); //system.debug(LoggingLevel.INFO,'Document link ' + 'https://logmeinsupport.com/kblive/crm/selfservice/displaywh.jsp?DocId=' + i.documentProperties.id); //system.debug(LoggingLevel.DEBUG,'Doc Properties: ' + i.documentProperties); //system.debug(LoggingLevel.INFO,'\n'); string docid = String.valueOf(i.documentProperties.id); String title = i.documentProperties.title; String link = 'https://logmeinsupport.com/kblive/crm/selfservice/displaywh.jsp?DocId=' + i.documentProperties.id; String viewRank = String.valueOf(i.documentProperties.viewRank); String voteRank = String.valueOf(i.documentProperties.voteRank); InstranetIntegration.Doc d = new doc(); d.docid = docid; d.title = title; d.link = link; d.viewRank = viewRank; d.voteRank = voteRank; docList.add(d); system.debug(LoggingLevel.DEBUG,'\n\nDocument ' + ctr + ': ' + d); ctr += 1; } } return docList; }

 

 

 

 Method in a different controller that pulls this list of "doc" (i debugged this to the log and still as expected).  i'm using static values for the InstranetIntegration.search() method for testing, but these definitely returnobjects.

 

Public InstranetIntegration.Doc[] getDocsList(){ InstranetIntegration inst = new InstranetIntegration(); List<InstranetIntegration.doc> docslist = inst.search('access coce','FAQLoc','lmipro','en'); return docslist; }

 

And finally, the VF page that's trying to pull this list

 

 

<apex:page controller="SelfServiceCon" showHeader="false" sidebar="false" id="page"> <apex:stylesheet value="{!URLFOR($Resource.SelfService, '/css.css')}"/> <apex:includeScript value="{!URLFOR($Resource.SelfService, '/jquery-1.3.2.min.js')}"/> <apex:includeScript value="{!URLFOR($Resource.SelfService, '/CommonValidation.js')}"/> <c:sifr /> <apex:actionRegion > <apex:outputPanel id="thanksmessage" > <apex:outputLabel id="thankstext" rendered="true" > <c:sifrreplaceh2title /> <h2 class="title">{!$Label.SupportContactThanks}</h2> <div style="width:90%; margin-top:15px;">{!$Label.CaseCreated}</div> <div style="width:90%; margin-top:10px;">{!$Label.TicketNumber} {!caseNumber}</div> </apex:outputLabel> </apex:outputPanel> </apex:actionRegion> <br /><br /> <h2 class="title">Here are some KB docs you may find helpful</h2> <apex:repeat id="docslist" value="{!docslist}" var="docs" > <apex:outputText id="docslist" value="{!docs}" /><br /> </apex:repeat> </apex:page>

 

 If I try and use value="{!docs.title}", I get a message stating that "title" isn't a property of InstranetIntegration.Doc(), which as you can see above, it clearly is.  I'm not normally quick to cry bug, but what exactly is the jibberish that the VF page is spitting out?

 

 

Moderator
SimonF
Posts: 7,980
0

Re: Weird system output when pulling a list of objects into a VF page

You need to use the property syntax or add getters to your Doc class for VF to be able to access them.
Cheers
Simon
docs | blog | twitter
Super Contributor
paul-lmi
Posts: 894
0

Re: Weird system output when pulling a list of objects into a VF page

Spot on.  I don't know what you mean by "property syntax", but the following solved it.

Public Class doc { Public String docid {get; set;} Public String link {get; set;} Public String title {get; set;} Public String viewRank {get; set;} Public String voteRank {get; set;} }

 

 

 Is the engineering team aware of this wacky output issue?  One would expect some exception to be thrown in a scenario like this, IMO.