function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ArchieTechie6ArchieTechie6 

Query and Split values by delimiter(semicolon) and display in <ul><li>

Hi All,
I am querying some data from custom object and this will be retrieved by semicolon seperated data. 
Below is my code:
public class CustomController {
public string prodNames  {get;set;} 
public CustomController()

qryProd = [ Select id ,ProdNames from ProdObj];  
}
if(qryProd<>null)
{
 prodNames      = qryProd[0].ProdNames;
}
}
}

In my VF Page:  
console.log('{!prodNames}') --->  This displays output as : Product1;Product2;Product45;Product49;

<apex:outputText style="font-weight:bold" value="All Product Names" /><br />
               <ul>               
               <li><apex:outputText value="{!prodNames }"/></li>             
              </ul>
 

I want to display this in a bullet list using <li> 
  • Product1
  • Product2
  • Product45
  • Product49
Can anyone help me here?

Thanks!

 
Best Answer chosen by ArchieTechie6
Alain CabonAlain Cabon

List<String> prodNames  {get;set;} 

prodNames = qryProd[0].ProdNames.split(',');

 <ul> 
<apex:repeat  value="{!prodNames}" var="prodName" >
    <li><apex:outputText value="{!prodName}"/></li>    
</apex:repeat>
</ul>

Regards

All Answers

Alain CabonAlain Cabon

List<String> prodNames  {get;set;} 

prodNames = qryProd[0].ProdNames.split(',');

 <ul> 
<apex:repeat  value="{!prodNames}" var="prodName" >
    <li><apex:outputText value="{!prodName}"/></li>    
</apex:repeat>
</ul>

Regards
This was selected as the best answer
ArchieTechie6ArchieTechie6
Thank You! This works!!
Alain CabonAlain Cabon
You have not selected the correct best answer by the way.but you can give points with the thumbs up emoticon.