Saed Alavinia
Saed Alavinia

Reputation: 234

Multiple EL values and strings used with a single HTML attribute

In my .xhtml pages in my JSF 2.0 application, I am trying to find out a way to have multiple EL values and strings to be used with a single HTML attribute. The following WRONG syntax will give you the idea:

<h:outputText value=" 'Welcome' + #{myBean.loggedInUser} + ' '  "/>

So I am wondering what is the correct way of doing it. I don't need a workaround (as h:outputText is just an example).

Also let me know if your suggestion works in JSP/JSF1.2 or not

Upvotes: 1

Views: 5062

Answers (2)

EdH
EdH

Reputation: 5003

The <h:outputFormat> component?

http://www.jsftoolbox.com/documentation/help/12-TagReference/html/h_outputFormat.html

I believe that is either JSF 1.2 or 2

Upvotes: -1

BalusC
BalusC

Reputation: 1109625

You don't need any special operators. You can just inline EL in text.

<h:outputText value="Welcome #{myBean.loggedInUser}" />

or

Welcome <h:outputText value="#{myBean.loggedInUser}" />

or even in template text

Welcome #{myBean.loggedInUser}

Upvotes: 2

Related Questions