0
I have a bean class as "UserBean" and it has an bean value as "name"
/**** UserBean bean class****/
@ManagedBean
@RequestScoped
public class UserBean {
    private String name;  

    public UserBean() {
    }

   //getter and setter for name
}

now in XHTML file (using JSF2 tags) when i am writing this 
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core">

<h:head>
    <title>UseBean as Plain Text</title>
</h:head>
<h:body>
    <h:form>
<h1> hello its me #UserBean.name </h:form></h:body></html>

在浏览器中,它检索名称字段的值,但我不希望这种情况发生。我想要的是在浏览器页面中只有一个纯文本,即“你好,它是我#UserBean.name”

这该怎么做??

4

1 回答 1

0

使用“\”和<outputtext>标签得到它

我这样做了-<h:outputText value="hello - \#\{userBean.name}" escape="false" />

于 2012-07-29T14:24:11.543 回答