10 Replies Latest reply on Feb 13, 2014 2:53 PM by Dirk Gerrit Oort

    Login with jsf form servers rfRes/skinning.ecss.xhtml page

    Dirk Gerrit Oort Newbie

      HI all,

       

      Starting an project with an jsf login page servers rfRes/skinning.ecss.xhtml page. Although I've seen it before, the page about this issue couldn't be found anymore because the forum could not be found.

      So:

       

      I've an login page :

      (login.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:h="http://java.sun.com/jsf/html" >

       

       

      <h:head>

          <title>  JSF 2 Login </title>

      </h:head>

      <h:body>

          <p>Login to access secure pages:</p>

          <form method="post" action="j_security_check">

              <h:panelGrid columns="2">

                  <h:outputLabel for="j_username" value="Username" />

                  <input type="text" id="j_username" name="j_username" />

                  <h:outputLabel for="j_password" value="Password" />

                  <input type="password" id="j_password" name="j_password" />

                  <input type="submit" name="submit" value="Login" />

              </h:panelGrid>

              <br />

          </form>

      </h:body>

      </html>

       

      and 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_3_0.xsd" version="3.0">

      <welcome-file-list>

          <welcome-file>/pages/index.xhtml</welcome-file>

        </welcome-file-list>

        <security-constraint>

          <display-name>login</display-name>

          <web-resource-collection>

            <web-resource-name>Wildcard means whole app requires authentication</web-resource-name>

            <url-pattern>/*</url-pattern>

            <http-method>GET</http-method>

            <http-method>POST</http-method>

          </web-resource-collection>

          <auth-constraint>

            <role-name>admin</role-name>

          </auth-constraint>

          <user-data-constraint>

            <transport-guarantee>NONE</transport-guarantee>

          </user-data-constraint>

        </security-constraint>

        <login-config>

          <auth-method>FORM</auth-method>

          <realm-name>MyRealm</realm-name>

          <form-login-config>

            <form-login-page>/pages/login.xhtml</form-login-page>

            <form-error-page>/pages/login-failed.html</form-error-page>

          </form-login-config>

        </login-config>

        <security-role>

          <role-name>admin</role-name>

        </security-role>

      <!-- JavaServer Faces Servlet -->

        <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 to URL pattern -->

        <servlet-mapping>

          <servlet-name>Faces Servlet</servlet-name>

          <url-pattern>*.xhtml</url-pattern>

        </servlet-mapping>

         <servlet-mapping>

          <servlet-name>Faces Servlet</servlet-name>

          <url-pattern>*.jsf</url-pattern>

        </servlet-mapping>

         <servlet-mapping>

          <servlet-name>Faces Servlet</servlet-name>

          <url-pattern>*.faces</url-pattern>

        </servlet-mapping>

      </web-app>

      and an simple 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:h="http://java.sun.com/jsf/html"

            xmlns:a4j="http://richfaces.org/a4j"

            xmlns:rich="http://richfaces.org/rich"

            xmlns:f="http://java.sun.com/jsf/core"

            xmlns:ui="http://java.sun.com/jsf/facelets">

       

      <h:head></h:head>

      <body>

          <rich:panel>

              <f:facet name="header">

              Write your own custom rich components with built-in AJAX support

              </f:facet>

              <h2>hello</h2>

          </rich:panel>

      </body>

      </html>

       

       

      and jboss-web.xml:

      <jboss-web>

            <security-domain>MyRealm</security-domain>

      </jboss-web>

       

      nothing special.

       

      When the login page is an normal html file the application runs fine, but when the loginpage is an jsf file as described above i get rfRes/skinning.ecss.xhtml page:

       

      Unexpected_page.png

       

      richfaces version: 4.3.4.Final

      server jboss 7.1 and wildfly-8.0.0.Beta1 both the same problems

       

      Is there an solution for this?