Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 bean,它有一个方法来检查用户是否登录并返回一个包含 HTML 代码的字符串。有什么方法可以在返回后在网页上呈现此字符串?
当然。在您的托管 bean 中:
public String checkLogin() { return "<h2><b>User was not logged in.</b></h2>"; }
在您的 xhtml 文件中:
<h:outputText escape="false" value="#{bean.checkLogin()}" />