2010-05-04 87 views
3

這是我在這裏看到的問題,但發佈的解決方案無法解決我的問題。再次我正在處理jsf 2.0,我有2頁:login.xhtml和index.xhtml,我也使用SpringSecurity進行身份驗證。 index.xhtml呈現正常,但登錄不(頁面源顯示未解析的jsf標記)。我已經停用SpringSecurity來檢查它是否與我的問題有關,但沒有運氣......我真的不知道我的代碼有什麼問題(連續兩天試圖找出它),所以任何幫助都會非常感謝。這裏是我的代碼:JSf標記未呈現

的web.xml login.xhtml

<h:head> 
    <title>Ejemplo JSF 2 AJAX</title> 
</h:head> 
<h:body> 
     <h:form id="login"> 
     <h:panelGrid columns="2"> 
      <h:outputLabel for="Usuario" value="Usuario:"/> 
      <h:inputText id="Usuario" value="#{loginBean.userName}" required="true"/> 
      <h:outputLabel for="Password" value="Contraseña:"/> 
      <h:inputSecret id="Password" value="#{loginBean.password}"  required="true"/> 
     </h:panelGrid> 
     <h:commandButton value="Ingresar" actionListener="#{loginBean.doLogin}"/> 
     <h:messages/> 
    </h:form> 
</h:body> 

任何想法的

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 
<context-param> 
    <param-name>javax.faces.PROJECT_STAGE</param-name> 
    <param-value>Development</param-value> 
</context-param> 

<!-- Spring Security --> 
<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>/WEB-INF/applicationContext.xml</param-value> 
</context-param> 

<listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
</listener> 
<filter> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
</filter> 
<filter-mapping> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 
<!-- Spring Security --> 

<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> 
<session-config> 
    <session-timeout> 
     30 
    </session-timeout> 
</session-config> 
<welcome-file-list> 
    <welcome-file>JSF2Example/index.xhtml</welcome-file> 
</welcome-file-list> 

一部分?非常感謝!

回答

4

頁面的源代碼顯示JSF標籤未解析

,可以有2個原因:

  1. 頁面URL不匹配FacesServleturl-pattern,因此它沒有任何有機會解析標籤。

  2. xmlns對於JSF組件的聲明在<html>標記中缺失,因此將其視爲明文。

+0

Hi BalusC,感謝您的幫助。我確實解決了將URL模式從/ faces/*更改爲* .xhtml 不知怎的,舊模式與Spring-Security配置相關。 – William 2010-05-06 14:54:34

+0

同樣在這裏。必須將其切換爲* .xhtml ... – 2010-05-10 18:37:33