How to display html code which is load from db in jsf screen? [duplicate] - jsf

This question already has an answer here:
Component to inject and interpret String with HTML code into JSF page
(1 answer)
Closed 6 years ago.
I have html code in one column. Loaded html code to one bean.
My question is how to display this html code using jsf tags.

You can use a <h:outputText> component, and set escape="false".

Related

How to create multiple anchor tag and fetch href value from database dynamically in JSF? [duplicate]

This question already has answers here:
Iterate through List<String> using JSF 2
(1 answer)
What URL to use to link / navigate to other JSF pages
(1 answer)
Using JSF EL in a plain HTML attribute
(3 answers)
Closed 27 days ago.
I want to create a dynamic anchor tag. Let's say I have a database and I want to use them.
Example:
Before
Page 1
Page 2
Page 3
It should be something like this
--After--
{Value from database}
#{linkOpsBean.srcNameList[0]}
Here's what worked for me!
<ui:repeat value="#{Bean.srcNameList}" var="value">
<li><a class="dropdown-item" href="#{value}">#{value}</a></li>
</ui:repeat>

p:selectBooleanCheckbox visibility property [duplicate]

This question already has answers here:
Conditionally displaying JSF components
(3 answers)
Closed 2 years ago.
I am new to primefaces and JSF. I want to make selectBooleanCheckbox visible by depending on some Boolean value in my bean. But there is no visibility feature. And if I add a panel the design changes. So do you have any suggestions?
<p:selectBooleanCheckbox id="idCheckbox" value="#{bean.object.value}" itemLabel="{bean.object.value.label}" styleClass="width100Percent" disabled="{bean.infomode}">
You can add "rendered" attribute to control whether the component is displayed.
<p:selectBooleanCheckbox id="idCheckbox"
value="#{bean.object.value}"
itemLabel="#{bean.object.value.label}"
styleClass="width100Percent"
disabled="#{bean.infomode}"
rendered="#{bean.showIt}"
>

How can I add JSF code to xhtml in the attribute id? [duplicate]

This question already has answers here:
How to dynamically generate id in dataTable using ui:repeat tag
(4 answers)
How to use EL with <ui:repeat var> in id attribute of a JSF component
(1 answer)
Closed 6 years ago.
I am working with JSF 2.2 and I would like use JSF variables in the id attribute for to send individuals petitions for each list's element.
For example:
<ui:repeat value="#{bean.numbers}" var="number">
<h:inputText id="text#{number}"/>
</ui:repeat>
Thank you

Using rendered with JSF [duplicate]

This question already has an answer here:
Why do I need to nest a component with rendered="#{some}" in another component when I want to ajax-update it?
(1 answer)
Closed 7 years ago.
How does rendered work? It hides h:form content completely and does not show it if expression.list is not empty.
<h:form id="stackForm" rendered="#{not empty expression.list}">
<p:orderList id="stack" value="#{expression.list}"...
...
It doesn't hide it - it doesn't render it at all, if rendered condition evaluates to false. In your case, if #{expression.list} is empty, form will not be rendered. Or, when rendered is translated to plain English, read it as Render the form if expression.list is not empty.

Jsf control that format text with html tags [duplicate]

This question already has an answer here:
Component to inject and interpret String with HTML code into JSF page
(1 answer)
Closed 6 years ago.
Good morning all.
Is there any jsf control that escapes the html tags?
Imagine that i have the following string in resources:
text.String=lalala<br/>lelele
and i want to print it on Xhtml file with a simple control like:
<h:outputText value="#{messages['text.String']}" />
how do i get the result formatted with the html <br/> tag?
Result should be:
lalala
lelele
instead of:
lalala<br/>lelele
Thanks
the outputText control has an 'escape' property which controls that behaviour.
See here (outputText reference).
So basically:
<h:outputText escape="false" value="#{messages['text.String']}" />
should do the job.

Resources