Question

i have a context param as follows:

  <context-param>
    <param-name>myInitParam</param-name>
    <param-value>myValue</param-value>
  </context-param>

i want to get an init param in JSF 1x (exact version is 1.1.02) as follows:

<object>
<param name="HTTPPort" value="#{initParam.myInitParam}" />

but i am getting the compiler error in JSP:

the attributes for a standard action or an uninterpreted tag cannot be deferred expressions

please advise how to get init param in JSF 1x, and what is the reference for EL used in JSF 1x.

Était-ce utile?

La solution

The EL variable is correct, but you can't use deferred EL #{} in template text in legacy JSP which is the default view technology in JSF 1.x. This is exactly what the error message is trying to tell you.

You need to print it using a <h:outputText>.

<f:verbatim><param name="HTTPPort" value="</f:verbatim><h:outputText value="#{initParam.myInitParam}" /><f:verbatim>" /></f:verbatim>

(note that I assume that you were already emitting plain HTML using <f:verbatim>)

Yes, that's one line of ugliness, but that's the payoff of using JSP and one of the main reasons why Facelets was introduced.

See also:

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top