为了账号安全,请及时绑定邮箱和手机立即绑定

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

标签:
Java

         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.SpringObjectFactoryFile: SpringObjectFactory.javaMethod: getClassInstanceLine: 209 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:209:-1Caused 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>

点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消