zoukankan      html  css  js  c++  java
  • 2012年1月零碎笔记

    获得当前应用的路径

    System.out.println("request.getContextPath():"+request.getContextPath());

    System.out.println("request.getSession().getServletContext().getContextPath():"+request.getSession().getServletContext().getContextPath());

     

    MyEclipse快捷键

    Ctrl+Shift+L:显示出所有的快捷键提示

     

    标签切换:

    Alt+左箭头,右箭头   以在编辑窗口切换标签

    Ctrl+e              弹出输入窗口,可以输入你想要编辑的代码窗口,和Ctrl+f6的功能相同,只不过一个是选择的方式,一个是输入的方式,切换窗口

    Ctrl+f6           可以弹出菜单,上面列出可以切换的编辑窗口,这样不用鼠标也可切换

    Alt+←            前一个编辑的页面

    Alt+→            下一个编辑的页面(当然是针对上面那条来说了)

    文本编辑

    Ctrl+Shift+O      自动加入引用package

    Ctrl+Shift+M       自动加入引用光标所在对象的package

    F3 =Ctrl+光标:    鼠标指向变量名,方法名,类名,快速跳转到源代码中

    shift+光标 光标移到被调用的方法上,动态显示方法对应的实现或声明

    Ctrl+T  :           可以直接显示光标所在的类的层次结构图,也可以输入过滤所要的类,并跳到所选类中

    Ctrl+1              快速修复(最经典的快捷键,就不用多说了)

    Ctrl+Shift+F      程序代码自动排版 , 整形,格式化代码

    Ctrl + D :          删除本行

    Ctrl+L 定位在某行 (对于程序超过100的人就有福音了)

    Ctrl+Shift+R        通过输入打开资源文件,open resource

    Shift+Enter         在当前行的下一行插入空行(这时鼠标可以在当前行的任一位置,不一定是最后)

    Shift+Ctrl+Enter    在当前行插入空行(原理同上条)

    Ctrl+Alt+↓         复制当前行到下一行(复制增加)

    Ctrl+Alt+↑         复制当前行到上一行(复制增加)

    Alt+↓              当前行和下面一行交互位置(特别实用,可以省去先剪切,再粘贴了)

    Alt+↑              当前行和上面一行交互位置(同上)

    Ctrl+h              搜索,打开搜索对话框,可以搜索JSP文件、JS文件、Plug-in、Spring Bean等

    Alt+Shift+L:        抽取本地变量( 可以直接把一些魔法数字和字符串抽取成一个变量,尤其是多处调用的时候)

    Alt+Shift+F:        把Class中的local变量变为field变量 (比较实用的功能)

    Alt+Shift+M         抽取方法 (这是重构里面最常用的方法之一了,尤其是对一大堆泥团代码有用)Alt+Shift+C 修改函数结构(比较实用,有N个函数调用了这个方法,修改一次搞定)

     

    将contronller没有被映射的方法,改成private

     

    在spring mvc框架上上传文件时,要注意<file>标签的name值,不要与对应的bean的属性相同,否则spring mvc 会报转换文件类型错误。

     

    mysql授权

    grant all PRIVILEGES on *.* to root@'%' IDENTIFIED by '123'

     

    jar 文件搜索:  http://www.jarvana.com/jarvana/

     

    生成javadoc

    生成javadoc中文乱码,在这里配置:-encoding UTF-8 -charset UTF-8

     

    找不到符号

    符号: HttpServletRequest

    解决方案:在项目的build path下添加jarservlet-api.jartomcat带的,jdk中没有。

     

    public static String YICHA_DOWN_XML_IN = "http://60.28.215.67/mXml/tdel.do?pvt=0&tit={0}&id={1}&key={2}" //红色标为占位符

    YiChaDown yiChaDown = this.yiChaService.getYiChaDownList(Config.YICHA_DOWN_XML_IN, tit, yid, " ");

    // 先从缓存获取本地歌曲下载地址

    downBean = (DownBean) this.commonService.getMemCache("ayyc_localSong"+ localSongId);

    downUrl = MessageFormat.format(downUrl, new Object[] {URLEncoder.encode(tit, "UTF-8"), id,URLEncoder.encode(key, "UTF-8") });

    yiChaDown = this.parseDownXmlByUrl(downUrl);

     

    jquery UI选项卡

        

    js

    <script type="text/javascript" >

            $(function()

            {

                $("#mydialog").dialog();

    $("#select").tabs();

                $("#select").click(function() { $("#info").css("display", ""); });

            });

    </script>

    html

    <div id="select">

    <ul>

                <li><a href="#phonebrands">品牌信息</a></li>

                <li><a href="#phones">手机信息</a></li>

    </ul>

    <div id="phonebrands">

     

    报错信息:

    2012-2-10 17:46:43 org.apache.catalina.core.ApplicationContext log

    严重: StandardWrapper.Throwable

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'musicManageController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ttpod.recommend.service.INonLocalService com.ttpod.recommend.view.manage.MusicManageController.nonLocalService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.ttpod.recommend.service.INonLocalService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)

     

    解决方案:在nonLocalService前面加上:@service ,以便系统在使用到这个service时就注入。

     

    jar 文件搜索:  http://www.jarvana.com/jarvana/

     

    1. 注意在 for 循环中用continue

    for(Node fileTypeNode:nodeList){

                  //文件类型:压缩,高质,普通

                  String fileType=fileTypeNode.getText();          

                  Items item=nonLocalDown.new Items();

                  if(fileType.indexOf("压缩")!=-1){

                      totalType.append("0");

                      item.setSize(fileType.substring(fileType.indexOf('[')+1,fileType.length()-1));

                  }else if(fileType.indexOf("清晰")!=-1){

                       totalType.append("1");

                       item.setSize(fileType.substring(fileType.indexOf('[')+1,fileType.length()-1));

                   }else if (fileType.indexOf("高音质")!=-1){

                       continue;

    //                 totalType.append("3");

    //                 item.setSize(fileType.substring(fileType.indexOf('[')+1,fileType.length()-1));

                   }else if (fileType.indexOf("保真")!=-1){

                       continue;

    //                 totalType.append("4");

    //                 item.setSize(fileType.substring(fileType.indexOf('[')+1,fileType.length()-1));

                   }

                   Node itemNode=fileTypeNode.getParent();

                   …………

                   item.setFiletype(fileType);

                  }

     

  • 相关阅读:
    fn project 试用之后的几个问题的解答
    fn project 扩展
    fn project 生产环境使用
    fn project 对象模型
    fn project AWS Lambda 格式 functions
    fn project 打包Function
    fn project Function files 说明
    fn project hot functions 说明
    fn project k8s 集成
    fn project 私有镜像发布
  • 原文地址:https://www.cnblogs.com/luowei010101/p/2370350.html
Copyright © 2011-2022 走看看