views:

280

answers:

1

Hi, this is a question i've seen here but the solution posted didn't resolve my issue. Again i'm dealing with jsf 2.0 and i have 2 pages: login.xhtml and index.xhtml, i'm also using SpringSecurity for auth purposes. index.xhtml renders ok but login doesn't(page source shows jsf tags un-parsed). I already deactivated SpringSecurity to check wether or not it had something to do with my issue but no luck...i really don't know what' wrong with my code (2 days straight trying to figure it out), so any help would be GREATLY appreciated. Here's my code:

web.xml

<?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"&gt;
<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>

part of 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>

Any ideas? thanks a lot!

+3  A: 

page source shows jsf tags un-parsed

That can have 2 causes:

  1. The page URL did not match the url-pattern of the FacesServlet, thus it had not any chance to parse the tags.

  2. The xmlns declarations for JSF components are missing in <html> tag, thus it was treated as plaintext.

BalusC
Hi BalusC, thanks for your help. I did resolved the issue changing the url-pattern from /faces/* to *.xhtmlSomehow the old pattern intefered with Spring-Security configuration.
William
Same here. Had to switch it to *.xhtml...
Brian Knoblauch