Can we have something like following in case of HTML + JSF
<meta name="description" content="#{MyBean.attr}"/>
i.e. can we set the value of "description" meta attribute dynmically?
Can we have something like following in case of HTML + JSF
<meta name="description" content="#{MyBean.attr}"/>
i.e. can we set the value of "description" meta attribute dynmically?
This will work when you're using JSF with Facelets as view technology. However, since you're asking this question it seems that you're using legacy JSP as view technology wherein unified EL (those #{}
things) in template text isn't supported. You need to use JSF h:outputText
component then to print the bean property.
<meta name="description" content="<h:outputText value="#{MyBean.attr}" />" />
Ugly, yes, but that's the payoff of sticking to a legacy view technology which isn't originally designed with JSF in mind ;) If you're curious about Facelets, have a look at its docbook. It's by the way the default view technology in JSF 2.0 and newer.
In pure HTML, no, it's not possible. If you configured your servlet mapping in web.xml to something of this effect (example):
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
Then, by all means. Also, you must have a library that can interpret OGNL.
Update Alternatively, see BalusC's answer.