You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Adil Farooq <ad...@mobex.com.pk> on 2010/06/21 15:30:31 UTC

problem with myfaces wap

i have tried to use myfaces wap api with tomahawk (myfaces-wap-1.0.9.jar)
and i have created a simple login page.
the rendering is fine but the request that the commandbuttons or command
links generate, only executes the first and the last phases of the jsf
lifecycle. i.e. the call is not being treated as a postback.

any idea of what the problem can be.
my web.xml ,faces-config and index.jsp are as follows


---------------------------------------- the web.xml file
------------------------------------------

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <context-param>
        <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>/WEB-INF/my-faces-config.xml</param-value>
    </context-param>
    <context-param>
        <description>State saving method: "client" or "server" (= default)
              See JSF Specification 2.5.3</description>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.STRICT_XHTML_LINKS</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.RENDER_VIEWSTATE_ID</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>

<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
        <param-value>20</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <description>
                Validate managed beans, navigation rules and ensure that
forms are not nested.
            </description>
        <param-name>org.apache.myfaces.VALIDATE</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
        <param-value>true</param-value>
    </context-param>

    <!-- 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>

    <!-- Faces Servlet Mapping -->

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>

    <filter>
        <filter-name>MyFacesExtensionsFilter</filter-name>

<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
        <init-param>
            <param-name>uploadMaxFileSize</param-name>
            <param-value>20m</param-value>
        </init-param>
    </filter>
    <listener>

<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
    </listener>

    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>

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

    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <url-pattern>*.jsf</url-pattern>
    </filter-mapping>
</web-app>


---------------------------------------- the faces config file
------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config>
    <lifecycle>
        <phase-listener>org.exadel.jsf.PhaseTracker</phase-listener>
    </lifecycle>
    <application>
        <default-render-kit-id>WML_BASIC</default-render-kit-id>
    </application>
    <navigation-rule>
        <from-view-id>/index.jsp</from-view-id>
        <navigation-case>
            <from-outcome>authenticated</from-outcome>
            <to-view-id>/text.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>
    <managed-bean>
        <managed-bean-name>userProfile</managed-bean-name>

<managed-bean-class>com.mobex.ebank.bean.UserProfile</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
</faces-config>

---------------------------------------- the web.xml file
------------------------------------------

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1 //EN" "
http://www.wapforum.org/DTD/wml_1.1.xml">
<%@ page contentType="text/vnd.wap.wml"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/wap" prefix="wap"%>

<wml>
<card id="testPage">
<p><f:view>
    <wap:form id="myform">Login Name: <wap:inputText
            id="testInput" value="#{userProfile.userName}"></wap:inputText>
        <wap:commandButton id="submit" value="Login"
            action="#{userProfile.authenticate}"
type="options"></wap:commandButton><br>
    </wap:form>
</f:view></p>
</card>
</wml>

thanks in advance
Adil