Java 不';在服务器端生成的JSF代码在xhtml中显示
我正在使用StringBuilder在java上生成Facelet。当我试图在.xhtml页面中获取生成的代码时,它只显示Java 不';在服务器端生成的JSF代码在xhtml中显示,java,jsf,primefaces,facelets,Java,Jsf,Primefaces,Facelets,我正在使用StringBuilder在java上生成Facelet。当我试图在.xhtml页面中获取生成的代码时,它只显示h:outputlabel文本。但当我打开我的页面代码时,它会显示如下内容 </style><span class="preformatted"><h:form style="margin: 0 auto"><h:panelGrid columns="1"><h:outputLabel id="label" for="de
h:outputlabel
文本。但当我打开我的页面代码时,它会显示如下内容
</style><span class="preformatted"><h:form style="margin: 0 auto"><h:panelGrid columns="1"><h:outputLabel id="label" for="descr">descr</h:outputLabel> <div> <b:inputText required="true" id="descr" value="#{parserBean.listWithData[0]}"></b:inputText></div><h:outputLabel id="label" for="birthday">birthday</h:outputLabel><p:calendar id="birthday" value="#{parserBean.listWithData[1]}" pattern="MM/dd/yyyy HH:mm:ss" /><h:outputLabel id="label" for="place">place</h:outputLabel> <div> <b:inputText required="true" id="place" value="#{parserBean.listWithData[2]}"></b:inputText></div></h:panelGrid> </h:form></span></body>
descr出生地
什么问题?我可以用java动态创建Facelet吗?或者如何转换它?
这是我的.xhtml页面
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:b="http://bootsfaces.net/ui"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
<h:head>
<title>Add data</title>
<h:outputScript library="js" name="jquery-3.2.1.min.js" />
</h:head>
<h:body>
<h:form>
<b:commandButton look="link" action="response?faces-redirect=true"
value="Response" />
<b:commandButton look="link" action="fields?faces-redirect=true"
value="Fields" />
</h:form>
<style>
.preformatted {
white-space: pre;
}
</style>
<h:outputText class="preformatted" escape="false"
value="#{parserBean.parseToHtml()}" />
</h:body>
</html>
添加数据
.预先格式化{
空白:预处理;
}
可能存在的副本另请参见