Jsf 将MyFaces 1.2迁移到2.1后,链接突然停止响应

Jsf 将MyFaces 1.2迁移到2.1后,链接突然停止响应,jsf,myfaces,Jsf,Myfaces,我最近将EclipseIndigo项目从JSF1.2切换到JSF2.1(使用MyFaces)。使用Tomcat7 奇怪的事情发生了:我建立了一个项目,它在短时间内运行良好 时间,然后突然(也许在我“清洁”之后)停止工作 单击命令链接不会产生任何操作,而支持bean的方法则不会 打了电话,什么也没发生。我尝试过做项目“clean”和Eclipse 重新启动,甚至系统重新启动,但这并没有帮助。唯一有帮助的是 我创建了一个全新的工作区和新项目——但同样的事情发生了: 这也只在短时间内起作用,并突然停止

我最近将EclipseIndigo项目从JSF1.2切换到JSF2.1(使用MyFaces)。使用Tomcat7

奇怪的事情发生了:我建立了一个项目,它在短时间内运行良好 时间,然后突然(也许在我“清洁”之后)停止工作 单击命令链接不会产生任何操作,而支持bean的方法则不会 打了电话,什么也没发生。我尝试过做项目“clean”和Eclipse 重新启动,甚至系统重新启动,但这并没有帮助。唯一有帮助的是 我创建了一个全新的工作区和新项目——但同样的事情发生了: 这也只在短时间内起作用,并突然停止以同样的方式工作 -命令链接只是对点击没有反应,我无法调试Java 代码来至少定位问题

为什么会有这种奇怪的行为

提前谢谢


更新:这是报告的JavaScript错误:

myfaces is not defined
onclick()onclick (line 2)
event = click clientX=840, clientY=252

return myfaces.oam.submitForm("j_id_6", "j_id_6:LOGIN");

function onclick(event) {
return myfaces.oam.submitForm("j_id_6", "j_id_6:LOGIN");
}
以下是原始XHTML文件:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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:f="http://java.sun.com/jsf/core" 
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:t="http://myfaces.apache.org/tomahawk">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Login</title>    
</h:head>
<body style="background-color:#3d3d3d;" text="#000000" link="#cc0000" alink="#666666" vlink="#cc0000" onload="document.forms[0].USERNAME.focus();">
<f:view>

<h:form target="_top">

    <table border="0" align="center" width="810" style="border: 2px black solid; background-image:url(images/header.jpg); margin:auto;" cellspacing="0" cellpadding="0">
        <tr>

        </tr>
    </table>
    <table align="center" width="810" style="border: 2px black solid; background-color:#ffffff;" cellspacing="0" cellpadding="0">
        <tr>
            <td width="100%" height="10" colspan="3" align="center" valign="middle">

            </td>
        </tr>
        <tr>
            <td colspan="3">
            <table width="778" align="center" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td valign="top" width="778"><h1>Login</h1>
                        <table cellpadding="0" cellspacing="0" border="0">
                              <tr>                                  
                                <td height="20"><font class="text">User Name: </font></td>
                                <td height="20"><font class="text"><t:inputText forceId="true" id="USERNAME" maxlength="50" value="#{LoginBean.username}" size="26" /></font></td>
                            </tr>
                            <tr>
                                <td height="20"><font class="text">Password: </font></td>
                                <td height="20"><font class="text"><h:inputSecret maxlength="30" value="#{LoginBean.password}" size="26" /></font></td>
                            </tr>
                            <tr>
                                <td height="20" colspan="2" align="right"><h:commandLink id="LOGIN" action="#{LoginBean.doLogin}"><h:graphicImage style="border: none" value="images/login.png" /></h:commandLink></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            </td>
        </tr>
    </table>

</h:form>    

</f:view>
</body>
</html>

登录
登录
用户名:
密码:
以下是生成的HTML:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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"><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Login</title></head>
<body style="background-color:#3d3d3d;" text="#000000" link="#cc0000" alink="#666666" vlink="#cc0000" onload="document.forms[0].USERNAME.focus();"><form id="j_id2030916047_790d5181" name="j_id2030916047_790d5181" method="post" action="/EWC/login.faces" enctype="application/x-www-form-urlencoded" target="_top">

    <table border="0" align="center" width="810" style="border: 2px black solid; background-image:url(images/header.jpg); margin:auto;" cellspacing="0" cellpadding="0">
        <tr>

        </tr>
    </table>

    <table align="center" width="810" style="border: 2px black solid; background-color:#ffffff;" cellspacing="0" cellpadding="0">
        <tr>
            <td width="100%" height="10" colspan="3" align="center" valign="middle">

            </td>
        </tr>
        <tr>
            <td colspan="3">
            <table width="778" align="center" border="0" cellspacing="0" cellpadding="0">
                <tr>

                    <td valign="top" width="778"><h1>Login</h1>
                        <table cellpadding="0" cellspacing="0" border="0">
                            <tr>                                    
                                <td height="20"><font class="text">User Name: </font></td>
                                <td height="20"><font class="text"><input id="USERNAME" name="USERNAME" type="text" value="" maxlength="50" size="26" /></font></td>
                            </tr>
                            <tr>
                                <td height="20"><font class="text">Password: </font></td>

                                <td height="20"><font class="text"><input type="password" name="j_id2030916047_790d5181:j_id2030916047_790d51ba" maxlength="30" size="26" /></font></td>
                            </tr>
                            <tr>
                                <td height="20" colspan="2" align="right"><script type="text/javascript" src="/EWC/javax.faces.resource/oamSubmit.js.faces?ln=org.apache.myfaces"></script><a href="#" onclick="return myfaces.oam.submitForm('j_id2030916047_790d5181','j_id2030916047_790d5181:LOGIN');" id="j_id2030916047_790d5181:LOGIN"><img src="images/login.png" style="border: none" /></a></td>
                            </tr>
                        </table>
                    </td>
                </tr>

            </table>
            </td>
        </tr>
    </table><input type="hidden" name="j_id2030916047_790d5181_SUBMIT" value="1" /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="5s3ZqoVcUIwarcQb6pVzFIPhMJIzbVHnjMrXdtgA1Nten7grU/y0hMGbHtFvIExuKQOwB3IGzcSDeuPfijYMcnK23q/2N1mduMdr6RskySGELSaI2w93nL9b8NE=" /></form>
</body>
</html>

登录
登录
用户名:
密码:

org.apache.myfaces.ALLOW_JAVASCRIPT
符合事实的
将其添加到urweb.xml中
一切都将开始。

您没有日志吗?您想要哪个日志?我将尝试提供。您在eclipse的控制台窗口或tomcat日志中没有看到任何日志吗?您的bean请求范围是什么(会话、视图等)。也许你可以发布一些代码?根据目前的信息,我只能猜测。让我做一个初步猜测:所有这些按钮都执行ajax请求,ajax响应都返回了
ViewExpiredException
,因为会话不会在服务器清理/热部署周期中持久化。使用webbrowser中的HTTP流量调试器工具(在Chrome/IE9中按F12或在Firefox中使用Firebug)调查并确认这一点。然后我们可以进一步讨论。@roel@BalusC日志文件中没有任何内容,没有报告错误-这就是问题所在,我不知道从哪里开始。所有bean都是
request
作用域。没有使用Ajax。使用Firefox,将尝试Firebug。
<context-param> 
    <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>    
    <param-value>true</param-value> 
</context-param>