1 Reply Latest reply on Apr 27, 2009 2:33 AM by Maxim Kuzmik

    JSF + RichFacet + navigation-rule

    Maxim Kuzmik Newbie

      Hello, All. I have next data:

      faces-config.xml

      <?xml version="1.0" encoding="UTF-8"?>
      
      <faces-config
       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-facesconfig_1_2.xsd"
       version="1.2">
       <managed-bean>
       <description>CallBack for login form in TEAdmin</description>
       <managed-bean-name>callBack_Login</managed-bean-name>
       <managed-bean-class>com.tigraengine.kernel.security.callbacks.CallBack_Login</managed-bean-class>
       <managed-bean-scope>request</managed-bean-scope>
       </managed-bean>
       <navigation-rule>
       <display-name>admin/index</display-name>
       <from-view-id>/admin/index.jsp</from-view-id>
       <navigation-case>
       <from-outcome>success</from-outcome>
       <to-view-id>/admin/main.jsp</to-view-id>
       </navigation-case>
       </navigation-rule>
      </faces-config>


      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_2_5.xsd" id="WebApp_ID" version="2.5">
       <display-name>TigraEngine</display-name>
      
       <!-- For Tigra Engine -->
       <servlet>
       <description>TigraEngine Main Servlet</description>
       <display-name>TEMainServlet</display-name>
       <servlet-name>TEMainServlet</servlet-name>
       <servlet-class>com.tigraengine.kernel.web.servlets.TEMainServlet</servlet-class>
       <init-param>
       <description>TigraEngine Config File</description>
       <param-name>config-file</param-name>
       <param-value>tigraengine-config.xml</param-value>
       </init-param>
       <load-on-startup>0</load-on-startup>
       </servlet>
       <servlet-mapping>
       <servlet-name>TEMainServlet</servlet-name>
       <url-pattern>*.htm</url-pattern>
       <url-pattern>*.html</url-pattern>
       </servlet-mapping>
       <servlet>
       <description>Servlet for Admin UI</description>
       <display-name>TEAdminServlet</display-name>
       <servlet-name>TEAdminServlet</servlet-name>
       <servlet-class>com.tigraengine.kernel.web.servlets.TEAdminServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
       <servlet-mapping>
       <servlet-name>TEAdminServlet</servlet-name>
       <url-pattern>*.tea</url-pattern>
       </servlet-mapping>
      
       <!-- Faces Config -->
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>server</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.richfaces.SKIN</param-name>
       <param-value>blueSky</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.richfaces.CONTROL_SKINNING</param-name>
       <param-value>enable</param-value>
       </context-param>
      
       <filter>
       <display-name>RichFaces Filter</display-name>
       <filter-name>richfaces</filter-name>
       <filter-class>org.ajax4jsf.Filter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>richfaces</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </filter-mapping>
      
       <listener>
       <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
       </listener>
      
      
       <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>*.jsf</url-pattern>
       </servlet-mapping>
      
       <welcome-file-list>
       <welcome-file>index.html</welcome-file>
       <welcome-file>index.htm</welcome-file>
       <welcome-file>index.jsp</welcome-file>
       </welcome-file-list>
      
       <login-config>
       <auth-method>BASIC</auth-method>
       </login-config>
      
      </web-app>


      admin/index.jsp
      <%@ page language="java" contentType="text/html; charset=Windows-1251" pageEncoding="Windows-1251"%>
      <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
      <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
      <!-- RichFaces tag library declaration -->
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      
      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=Windows-1251">
      <title>Вход в �и�тему упралвени� TigraEngine</title>
      </head>
      <body>
       <f:view>
       <a4j:form ajaxSubmit="true" id="formLogin" binding="#{callBack_Login.formLogin}">
       <rich:panel header="Вход в �и�тему" style="width: 400px">
      
       <h:outputLabel id="lb_errorMessage" binding="#{callBack_Login.lb_errorMessage}"></h:outputLabel>
       <h:panelGrid columns="3">
       <h:outputText value="Ваш логин: " />
       <h:inputText id="fld_login" required="true" requiredMessage="Введите логин" value="#{user.login}" binding="#{callBack_Login.fld_login}">
       </h:inputText>
       <rich:message for="fld_login" />
      
       <h:outputText value="Ваш пароль: " />
       <h:inputSecret id="fld_password" required="true" requiredMessage="Введите пароль" value="#{user.password}" binding="#{callBack_Login.fld_password}">
       </h:inputSecret>
       <rich:message for="fld_password" />
      
       </h:panelGrid>
       <a4j:commandButton id="btnLogin" value="Войти" binding="#{callBack_Login.btnLogin}" action="#{callBack_Login.btnLogin_action}"/>
       </rich:panel>
       </a4j:form>
       </f:view>
       </body>
      </html>
      



      com.tigraengine.kernel.security.callbacks.CallBack_Login
      public class CallBack_Login{
       private HtmlAjaxCommandButton btnLogin;
       private AjaxForm formLogin;
       private HtmlInputText fld_login;
       private HtmlInputSecret fld_password;
       private HtmlOutputLabel lb_errorMessage;
      
       public CallBack_Login(){
       }
      
       public Object btnLogin_action(){
       if (fld_login.getValue().toString().equals("guest")){
       return "success";
       }else{
       //lb_errorMessage.setValue("Login failure!!!");
       return "failure";
       }
       }
      
      [...get|set...]
      


      По логике вещей когда � ввожу логин guset он должен открывать �траницу main.jsp а он вываливет�� � ошибкой =(
      Сведени� об ошибке на веб-�транице

      �гент пользовател�: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)
      штамп времени: Mon, 27 Apr 2009 10:04:46 UTC


      Сообщение: Объект не поддерживает �то �вой�тво или метод
      Строка: 172
      Символ: 390
      Код: 0
      URI-код: http://127.0.0.1:8080/a4j/g/3_3_0.GAorg.ajax4jsf.javascript.AjaxScript.jsf



      Может кто знает в чем проблема?