我使用GlassFishV3,JSF2,漂亮面臨3漂亮面臨JSF的GlassFish工作`噸我
我已經嘗試了很多擺脫我* .xhtml擴展鄰美化我的URL的組合,但我沒有做到這一點。
請,如果你知道另一種解決方案給我如何做到這一點,或者如果我的解決辦法是plausable請告訴我一個例子是我出了問題:
我也跟着在http://ocpsoft.org/prettyfaces/ SND的教程中創建一個簡單的應用程序只用一個index.xhtml和我已經鏈接到home.xhtml(都在WebContent中)。
- 我DWL罐子(我不`噸使用Maven),我因爲在使用把它放在WEB-INF/lib目錄
- 根據教程我不`噸需要改變我的web.xml GlassFishv3
我的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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>extension</display-name> <welcome-file-list> <welcome-file>index.xhtml</welcome-file> </welcome-file-list> <context-param> <param-name>com.ocpsoft.pretty.DEVELOPMENT</param-name> <param-value>true</param-value> </context-param> <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>*.xhtml</url-pattern> </servlet-mapping></web-app>
我漂亮-config.xml中
<pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.3.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.3.3 http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.3.xsd "> <url-mapping id="home"> <pattern value="/home" /> <view-id value="/home.xhtml"/> </url-mapping> </pretty-config>
- 這個配置我不斷收到java.lang.StackOverflowError的(與他人或我的應用程序不`噸編譯或我得到一個不同的錯誤)的循環是
在com.sun.faces.facelets.impl .DefaultFacelet.include(DefaultFacelet.java:308) at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367) at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet .java:346) at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199) at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155 ) at co m.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) 在com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
- 我的索引.xhtml的作品,但當我點擊鏈接上面的錯誤出現
- 我沒有任何豆(另一個問題是,如果我必須把任何anotations配對豆,如果我設法得到漂亮的臉)
非常感謝您的時間!
的修改:
我做了一個簡單的Web應用程序,看看擴展的隱藏是如何工作的。 的的index.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"><ui:composition template=""> <ui:define name="header"> Add your header here or delete to use the default </ui:define> <ui:define name="content"> <a id="home" href="home.xhtml">Home</a> </ui:define> <ui:define name="footer"> Add your footer here or delete to use the default </ui:define></ui:composition>
和家庭。XHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="">
<ui:define name="header">
Add your header here or delete to use the default
</ui:define>
<ui:define name="content">
home#######
</ui:define>
<ui:define name="footer">
Add your footer here or delete to use the default
</ui:define>
</ui:composition>
</html>
,如果我現在開始應用
127.0.01:8080/MYAPP有瞬間的錯誤java.lang.StackOverflowError的
但如果我只是把的index.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:body>
<a id="home" href="home.xhtml">Home</a>
</h:body>
</html>
和home.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:body>
HOME
</h:body>
</html>
它的工作原理,但擴展名是prezent 開始與127.0.0.1:8080/myapp/,然後點擊鏈接和127.0.0.1:8080/myapp/home.xhtml
我想做它像第一個索引和模板的家,因爲我工作一個已經有模板的網絡應用程序。 「a href」標籤中的id =「home」我不用t know if it is necesary, the id it
來由CSS來格式化它,但我越來越鄙視:))
任何幫助,將不勝感激。謝謝!
### MODIFICATIONS- ,所以我用一個簡單的Web應用程序再次開始看到的面孔是多麼漂亮的工作
- 現在我不
t get any errors but I still can
噸改變我的URL 我做了什麼至今:
我把漂亮,臉上的JSF-3.3.3.jar在WEB-INF/lib目錄
我把WEB-INF漂亮-config.xml中
<?xml version="1.0" encoding="UTF-8"?><pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.3.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.3.3 http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.3.xsd"> <url-mapping id="home"> <pattern value="/home" /> <view-id value="/home.xhtml" /> </url-mapping>
我的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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>test</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <context-param> <param-name>com.ocpsoft.pretty.DEVELOPMENT</param-name> <param-value>true</param-value> </context-param> <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>*.xhtml</url-pattern> </servlet-mapping></web-app>
在WEB-INF我的index.html,home.xhtml和的template.xhtml
指數。 html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:body>
<a href="home.xhtml">HOME</a>
</h:body>
</html>
home.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="/tempate.xhtml">
<ui:define name="header">
Add your header here or delete to use the default
</ui:define>
<ui:define name="content">
########################
</ui:define>
<ui:define name="footer">
Add your footer here or delete to use the default
</ui:define>
</ui:composition>
</html>
的template.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
<title><ui:insert name="title">Default title</ui:insert></title>
</head>
<body>
<div id="header">
<ui:insert name="header">
Header area. See comments below this line in the source.
<!-- include your header file or uncomment the include below and create header.xhtml in this directory -->
<!-- <ui:include src="header.xhtml"/> -->
</ui:insert>
</div>
<div id="content">
<ui:insert name="content">
<ui:include src="home.xhtml" />
</ui:insert>
</div>
<div id="footer">
<ui:insert name="footer">
Footer area. See comments below this line in the source.
<!-- include your header file or uncomment the include below and create footer.xhtml in this directory -->
<!--<ui:include src="footer.xhtml"/> -->
</ui:insert> </div> </body></html>
,因爲我用Glassfishv3
正如我我didn`t改變我的web.xml與
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5"><filter>
<filter-name>Pretty Filter</filter-name>
<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>Pretty Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
<dispatcher>ASYNC</dispatcher>
</filter-mapping></web-app>
說這是一個簡單的網絡應用程序,只是爲了看看它是如何工作的。 請幫我理解爲什麼我有困難...
你能分享xhtml文件嗎? – chkal
我編輯了我原來的問題。 – CyberGriZzly
設置漂亮臉蛋的基本步驟是什麼?我做了一些絕對錯誤的事情......我看到它的每一處都說它非常簡單... – CyberGriZzly