Hello all,
This isn't myfaces specific, more general jsf, so I hope I'm not abusing the
list by asking here. I'm a student just learning jsf and a sample
application I created works fine, but my own application is failing.

I have a few pages at http://npgrid.fsu.edu, all of which I've included
below. An index.jsp redirects to home.jsp, which has links to login.jsp.
They work the first time, but after hitting the browser's 'back' button they
fail with the following error:

java.lang.NullPointerException
        java.io.File.<init>(File.java:234)
        
com.sun.faces.application.StateManagerImpl.hasViewChanged(StateManagerImpl.j
ava:231)
        
com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java
:287)
        
com.sun.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:2
64)
        
com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:157)
        com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
        com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
        javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)


I am coding this with Websphere application developer 5.1.2, with Tomcat
5.5.9 as a standalone server. It works within WSAD's test server in the IDE,
only the published version breaks. Even the plain <a> tag doesn't work, so I
suspect I'm making a fundamental error like not including a config file or
something; but as you can see below I've tried a lot of variations.
Any help would be greatly appreciated.
Regards,
Jason
[EMAIL PROTECTED]



What I've done:
        Run test application "JSF Calculator" at
http://npgrid.fsu.edu/JSFCalc/faces/calculate.jsp    It works fine.


        Assuming problem was because of redirect:

                Got rid of redirect (<% response.sendRedirect("home.faces");
%>), accessed web-app directly through http://npgrid.fsu.edu/faces/home.jsp 
                        -- Some effect, the error was immediate rather than
occurring only after hitting the 'back' button. This was true in both the
live version on Tomcat and in WSAD's test server.

       Getting rid of redirect by adding "home.faces", "home.jsp",
"/faces/home.jsp" in various combinations to web.xml's <welcome-file> list
                        -- application wouldn't load at all, 404 error. Not
sure why. I thought since the redirect to 'home.faces' works adding a
<welcome-file>home.faces</welcome-file> to web.xml would work. 



        Assuming problem was because faces servlet wasn't being called:

         Various combinations of <url-pattern> in web.xml, such as /faces/*,
*.faces, *.jsp -- no effect.

        Assuming problem is b/c using IBM specific components or something
in WSAD 5.1.2:
       Using <h:outputLink> instead of websphere's <hx:outputLinkEx>
        -- no difference

        All others:
       Use <verbatim> <a href="npgrid.fsu.edu/login.jsp">login</a>
       



                Files in the application:
                                web.xml file (I've removed a bunch of
<taglib> entries that WSAD uses):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";>
<web-app id="WebApp">
        <display-name>fsuGrid</display-name>
        <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>
        </servlet>
        <servlet>
                <servlet-name>JS Resource Servlet</servlet-name>
        
<servlet-class>com.ibm.faces.webapp.JSResourceServlet</servlet-class>
                <load-on-startup>-1</load-on-startup>
        </servlet>
        <servlet-mapping>
                <servlet-name>JS Resource Servlet</servlet-name>
                <url-pattern>/.ibmjsfres/*</url-pattern>
        </servlet-mapping>
        
        <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>*.faces</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>/faces/*</url-pattern>
        </servlet-mapping>
        <welcome-file-list>
                <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
</web-app>



                                faces-config.xml
<faces-config>
        <lifecycle>
        
<phase-listener>com.ibm.faces.webapp.ValueResourcePhaseListener</phase-liste
ner>
        </lifecycle>
        <managed-bean>
                <managed-bean-name>pc_Home</managed-bean-name>
                <managed-bean-class>pagecode.Home</managed-bean-class>
                <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
                <managed-bean-name>pc_Login</managed-bean-name>
                <managed-bean-class>pagecode.Login</managed-bean-class>
                <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <!-- tried using a command button to navigate, didn't work either
-->
        <navigation-rule>
                <navigation-case>
                        <from-outcome>login</from-outcome>
                        <to-view-id>/login.jsp</to-view-id>
                </navigation-case>
        </navigation-rule>

</faces-config>


                                index.jsp 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%-- jsf:codeBehind language="java"
location="/JavaSource/pagecode/Login.java" --%><%-- /jsf:codeBehind --%>

<HTML>
<HEAD>
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
<%@ page 
language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>login.jsp</TITLE>
</HEAD>

<f:view>
        <BODY>
        <P>So the user would login here.<BR>
        <BR>This works fine the first time, but after hitting 'back' the
links to this page result in an error.
        </P>
        </BODY>
</f:view>
</HTML>


                                        home.jsp (similar <head> as above)
<f:view>
        <BODY><hx:scriptCollector id="scriptCollector1">
          Currently debugging an error. <BR>The links below work correctly
the first time, but after hitting the 'back' button they fail.<BR>
                <BR>
                <hx:outputLinkEx styleClass="outputLinkEx"
value="login.faces"
                        id="linkEx1">
                        <h:outputText id="text1" styleClass="outputText"
                                value="Login registered
user"></h:outputText>
                </hx:outputLinkEx>
                <BR>
        <BR>
        
        </hx:scriptCollector></BODY>
</f:view>
</HTML>


                                                login.jsp
<f:view>
        <BODY>
        <P>So the user would login here.<BR>
        <BR>This works fine the first time, but after hitting 'back' the
links to this page result in an error.
        </P>
        </BODY>
</f:view>






Reply via email to