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
dreamrealdreamreal 

Apex Extension to Visualforce

I wrote an overcomplicated piece of code in an apex extension that creates a string which I want to act as code and be proceessed as visualforce. Unfortunately, it is just displayed as text. I'll give an example:

 

public String gettester() {
return '<b> Something: </b>';
}

 

I want this to return Something: but instead it'll return <b> Something: </b>.

Is there anyway to obtain the result I want?

aballardaballard

You can embed raw html (as in your example), but NOT visualforce markup, by using <apex:outputText escape='false' >

 

Note if you use this it is up to you to ensure your page is not vulnerable to cross-site scripting or other security attacks. 

dreamrealdreamreal

Thanks!

 

Using this would it be possible to do this?

 

 

public String gettester() {

integer amount = 15;

return '<b> Something: </b>' + amount + '$';
}