+ Start a Discussion
waylonatcimwaylonatcim 

HTML tags and strings

I have the following code on a visualforce page:

 

<apex:outputText escape="false" >
 <h1>
  {!description}
 </h1>
</apex:outputText>

 

 

Where description is a string in my component that is set as the following:

 

 

description = 'Description:<ul><li>Bullet Point</li></ul>';

 

Unfortunately the output on the screen is:

Description:<ul><li>Bullet Point</li></ul>

Where the h1 tags are working correctly, but anything that comes from the string value in the controller is displayed literally.  Is there any way to display the string as I'm hoping, with the list being displayed properly?

 

Thanks!

 

aballardaballard

escape=false controls the text that is included by the value attribute of apex:outputText.  

 

Try:

<h1>

<apex:outputText escape="false" value="{!description}"/>

</h1>

 

 

As always when using escape=false, you should make sure you are not creating a security hole that would facilitate cross-site scripting.