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
KIRONKUMARKKIRONKUMARK 

Whats the difference betweet <apex:outputLabel> and <apex:outputtext>

Whats the difference between apex:outputLabel and apex:outputtext Both are looking for the same kind of purpose, whats the difference. Kiran.
Navatar_DbSupNavatar_DbSup

Hi,

Apex :Output Label

The outputLabel tag renders an HTML "label" element. It allows you to customize the appearance of the label using CSS styles. The outputLabel component is associated with another component via its "for" attribute. The other component must be created before the outputLabel component when the JSF page is rendered.

Note the use of the panelGroup container in the example below. The panelGroup component renders its children, allowing the outputLabel component to locate the inputText component at render time.

 Example

<apex::panelGroup>

  <apex::outputLabel id="usernameLabel" for="username" value="#{bundle.usernameLabel}" />

  <apex::inputText id="username" value="#{userBean.user.username}}" />

</apex:panelGroup>

 HTML Output

<label id="form:usernameLabel" for="form:username">Username</label>

<input id="form:username" name="form:username" type="text" value=""/>

 

Apex:Output Text

 

OutputText is for just that, text output, but keep in mind this will output text for html by default so it escapes characters as needed.

Displays text on a Visualforce page. You can customize the appearance of < apex:outputText > using CSS styles, in which case the generated text is wrapped in an HTML < span > tag. You can also escape the rendered text if it contains sensitive HTML and XML characters.

 

Example

 

<apex:outputText style="font-style:italic" value="This is {0} text with {1}.">

       <apex:param value="my"/>

       <apex:param value="arguments"/>

</apex:outputText>

 

HTML Output

<span>This is my text with arguments.</span>

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.