新的Ajax.Request重定向到新的jsp失败。

时间:2013-04-12 17:19:45

标签: ajax glassfish struts prototype

我有2个登录页面,login.jsp和loginMobile.jsp。 Login.jsp是默认登录页面,在web.xml中配置 在登录login.jsp时,调用javascript方法isMobile。

在更改URL时,需要将请求转发给loginMobile.jsp。

FRAMEWORK:struts1,AJAX + prototype + GLASSFISH 3.1.2

2个登录页面:

的login.jsp

<script src="scripts/prototype.js" type="text/javascript"></script>
<script src="scripts/login.js" type="text/javascript"></script>

<script type="text/javascript" charset="utf-8">
    isMobile();
</script>

<html>
<body>
<p> AM IN LOGIN PAGE </p>
</body>
</html>

loginMobile.jsp

<script src="scripts/prototype.js" type="text/javascript"></script>
<script src="scripts/login.js" type="text/javascript"></script>

<html>
<body>
<p> AM IN MOBILE PAGE </p>
</body>
</html>

在login.js内部

function isMobile()
{
//check some conditions then call below AJAX
new Ajax.Request('/loginMobile.jsp', { method:'post' });
 }  

//投诉的文件未找到!     “找不到C:\ Users \ dummy \ AppData \ Roaming \ NetBeans \ 7.2.1 \ config \ GF3 \ domain1 \ docroot \ loginMobile.jsp”

还试过

function isMobile()
{
//check some conditions then call below AJAX

var athena_login_url =  window.location.href+'/loginMobile.jsp';
new Ajax.Request(athena_login_url, { method:'post' });

}       

//转到默认的login.jsp

任何建议表示赞赏。先感谢您。

0 个答案:

没有答案