JSF2.2不使用html5
JSF2.2标记不适用于html5。它与.xhtml完美配合 html页面JSF2.2不使用html5,html,managed-bean,jsf-2.2,Html,Managed Bean,Jsf 2.2,JSF2.2标记不适用于html5。它与.xhtml完美配合 html页面 <!DOCTYPE html> <html xmlns:jsf="http://xmlns.jcp.org/jsf" xmlns:p="http://xmlns.jcp.org/jsf/passthrough" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core" x
<!DOCTYPE html>
<html xmlns:jsf="http://xmlns.jcp.org/jsf"
xmlns:p="http://xmlns.jcp.org/jsf/passthrough"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:c="http://java.sun.com/jstl/core">
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<input type="text" jsf:id="input1" jsf:value="#{Sample.name}" />
<h:inputText value="#{Sample.name}" >
<f:passThroughAttribute name="placeholder" value="Enter text" />
</h:outputText>
</body>
</html>
在此处插入标题
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>sample-war</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
</web-app>
样本战
Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
*.面孔
Facesservlet
*.xhtml
com.sun.faces.config.ConfigureListener
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
<managed-bean>
<managed-bean-name>Sample</managed-bean-name>
<managed-bean-class>com.sample.SampleBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
样品
com.sample.SampleBean
一场
托管bean出现在核心模块webapp contents in war中。我把水壶装在耳朵里,试图把它装在玻璃鱼身上。
任何答案都会有很大帮助。让我猜猜:您的“html页面”的文件扩展名是
。html
?B/c您的Facesservlet未配置为处理这些文件。它不应该这样。Facelet是标准定义的XHTML。输出可能是有效的HTML5。我正在尝试用HTML5实现jsf2.2。我的要求是在html5中重新编写jsf标记。尽管据说html5支持jsf2.2,但它对我来说不起作用。另一种方法是:现在可以使用JSF-2.2生成HTML5(这在以前是不可能的,因为JSF剥离了您的“非HTML”属性)。虽然可以将xhtml文件命名为*.html
,但您需要告诉JSF您是通过包含适当的servlet映射来实现的。将
替换为
也不起作用。