温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

添加到收藏夹及tomcat启动报错

发布时间:2020-07-19 15:01:29 来源:网络 阅读:386 作者:suqingyun123 栏目:web开发
Tomcat报错的问题:在控制台打出的
 at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance...

警告: Failed startup of context com.google.apphosting.utils.jetty.DevAppEngineWebAppContext@1242b11{/,E:\workspace\uploadPhoto\war}

Class: com.opensymphony.xwork2.spring.SpringObjectFactory
File: SpringObjectFactory.java
Method: getClassInstance
Line: 209 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:209:-1
Caused by: java.lang.NullPointerException  at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:209)

原因两个:
1.lib中多导入包的大原因:去掉struts2-spring-plugin-2.1.8包即可,因为没有用到spring。
2.还有的原因是用spring了,却没加监听器,在web.xml里面加上
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


添加文件夹方式:

<script type="text/javascript">
function AddFavorite(sURL, sTitle)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败,有劳您手动添加。");
        }
    }
}
</script>
<a href="JavaScript:window.external.AddFavorite('http://127.0.0.1','Page')"> <font color="white">
添加到收藏夹 </FONT> </a>
是用来添加到收藏夹的
关闭网页时弹出设为主页对话框代码: 
<BODY id=iehomepage 
onunload="iehomepage.style.behavior=’url(#default#homepage)’;if(!(iehomepage.isHomePage(’
htto;//www.csdn.net’)))iehomepage.setHomePage(’htto;//www.csdn.net’);">
打开网页弹出设为主页对话框代码: 
<BODY id=iehomepage 
onload="iehomepage.style.behavior=’url(#default#homepage)’;if(!(iehomepage.isHomePage(’
htto;//www.csdn.net’)))iehomepage.setHomePage(’htto;//www.csdn.net’);">
单击链接设为主页 
<a href=# onClick="this.style.behavior=’url(#default#homepage)’;this.setHomePage(’
htto;//www.csdn.net’);">设为主页</a>
鼠标滑过设定为主页 
<a href=# onMouseOver="this.style.behavior=’url(#default#homepage)’;this.setHomePage(’
htto;//www.csdn.net’);">设为主页</a>
附添加到收藏夹代码:
离开网页时弹出 
<script language="javascript"> 
function bookmarkit(){window.external.addFavorite(’htto;//www.csdn.net’,'我的家')}</script> 
<body onunload="bookmarkit()">
网页载入时弹出 
<script language="javascript"> 
function bookmarkit(){window.external.addFavorite(’htto;//www.csdn.net’,'我的家')}/ 
</script> 
<body onload="bookmarkit()">
右键弹出 
<script language=javascript1.2> 
document.all.onMouseDown=new Function("if (event.button==2||event.button==3)
window.external.addFavorite(’htto;//www.csdn.net’,'我的家')")/ 
</script>
单击文字弹出 
<script language="javascript"> 
function bookmarkit(){window.external.addFavorite(’htto;//www.csdn.net’,'我的家')}/ 
if (document.all)document.write(’<a href="#" onClick="bookmarkit()">加入收藏夹</a>’) 
</script>
鼠标滑过文字弹出 
<script language="javascript"> 
function bookmarkit(){window.external.addFavorite(’htto;//www.csdn.net’,'我的家')}/ 
if (document.all)document.write(’<a href="#" onMouseOver="bookmarkit()">加入收藏夹</a>’)

这个问题主要出现在 IE7 浏览器的时候,当然如果你是从 IE7 升级上来的,可能也受影响。
下面贡献一个我的 javascript 加入收藏 函数代码,兼顾了IE浏览器, 360浏览器, firefox浏览器等,你可以在此函数基础上优化和进一步完善。
function collect(){
    var ctrl = (navigator.userAgent.toLowerCase()).indexOf('mac') != -1 ? 'Command/Cmd': 'CTRL';
    try{
        if (document.all) { //IE类浏览器
            try {
                window.external.toString(); //360浏览器不支持window.external,无法收藏
                window.alert("国内开发的360浏览器等不支持主动加入收藏。\n您可以尝试通过浏览器菜单栏 或快捷键 ctrl+D 试试。");
            }
            catch (e){
                try{
                    window.external.addFavorite(window.location, document.title);
                }
                catch (e){
                    window.external.addToFavoritesBar(window.location, document.title);  //IE8
                }
            }
        }
        else if (window.sidebar) { //firfox等浏览器
            window.sidebar.addPanel(document.title, window.location, "");
        }
        else {
            alert('您可以尝试通过快捷键' + ctrl + ' + D 加入到收藏夹~');
        }
    }
    catch (e){
        window.alert("因为IE浏览器存在bug,添加收藏失败!\n解决办法:在注册表中查找\n HKEY_CLASSES_ROOT\\TypeLib\\{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}\\1.1\\0\\win32 \n将 C:\\WINDOWS\\system32\\shdocvw.dll 改为 C:\\WINDOWS\\system32\\ieframe.dll ");
    }
}

eg:
<body>
<a onclick="window.external.addFavorite('http://www.baidu.com','baidu')" title="收藏本站到你的收藏夹"  href="void(0)">收藏本网< /a>
</body>
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI