开发者

How to have unique keywords and description on each page of jsp/jsf?

开发者 https://www.devze.com 2022-12-17 12:23 出处:网络
Our website skill-guru has dynamic contents. So we have lots of test and quiz and each page has this at top

Our website skill-guru

has dynamic contents. So we have lots of test and quiz and each page has this at top

The keywords开发者_JS百科 and description has to be unique for each test page.

meta name="keywords" content="keyword 1 , keyword 2"

meta name="description" content="The description goes here"

How can we set this dynamically ?

This is JSF based web application


Just use <h:outputText> the usual way to output text dynamically:

<meta name="keywords" content="<h:outputText value="#{bean.keywords}" />" />

Or, if you're using <f:loadBundle> to maintain localized text:

<meta name="keywords" content="<h:outputText value="#{bundle.keywords}" />" />

Of course the particular line must be enclosed in a <f:view> to get it to work. Just wrap the whole <html> inside <f:view> then.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号