知识点

1、webservice

  利用String address="http://172.16.6.89:8080/webService";     Endpoint.publish(address, new WebServiceImpl());发布service 

  生成客户端程序,通过代理访问对应方法便可,需要 mail.jar

  接口和实现类 需要加上 @WebService @WebMethod 这两个注解

  如果是web项目就利用监听器来启动项目 @WebListener  监听类实现 ServletContextListener 初始化web时,发布项目

  果子利用servlet  @WebServlet(value="",loadOnStartup=0)  类继承  HttpServlet   初始化servlet时,发布项目

  实现ApplicationListener  web启动时会调用该类

2、加载顺序,js css都会被mvc的拦截器拦截  拦截顺序 从上到下  然后是 src的图片 再然后是验证码

3、tomcat启动就会加载filter,并执行初始化方法,有没有fileter-mapping并不影响执行init方法,传递filterCongif 参数,可以取到init-param注入的参数值

4、session.invalidate() 清除session

5、classpath指代的是classes下面的目录,生成class代码后src以及和他同一级目录并不生成文件夹,若要读取WebRoot下的文件,则需要/web-inf/..注意直接在spring配xml文件不能获取,但可以得到properties 并且web.xml中可以得到xml配置文件

6、支付宝电脑支付 demo http://aopsdkdownload.cn-hangzhou.alipay-pub.aliyun-inc.com/demo/alipaydirect.zip

7、异常处理 http://blog.csdn.net/eson_15/article/details/51731567

   <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
         定义默认的异常处理页面
        <property name="defaultErrorView" value="error.shtml"/>
        定义异常处理页面用来获取异常信息的变量名,也可不定义,默认名为exception
        <property name="exceptionAttribute" value="ex"/>
        定义需要特殊处理的异常,这是重要点
        <property name="exceptionMappings">
            <props>
                <prop key="com.longcai.CustomException">custom_error 直接写页面名称就可以,不用加.do 或者.jsp</prop>
            </props>
            还可以定义其他的自定义异常
        </property>
    </bean>

  这种方式只能直接跳转到异常页面,不能对异常过程进行操作,若要对异常进行操作,则使用全局异常处理便可以

  需要实现 HandlerExceptionResolver 

  spring中配置 <bean class="com.longcai.CustomExceptionResolver"></bean>  

  public ModelAndView resolveException(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2,
            Exception ex) {
        ex.printStackTrace();
        CustomException customException=null;  为自定义的异常类
        if(ex instanceof CustomException){
            customException=(CustomException) ex;
        }else{
            customException=new CustomException("未知错误");
        }
        ModelAndView mv=new ModelAndView();
        mv.addObject("message",customException.getMessage());
        mv.setViewName("error1");
        return mv;
    }

8、http://blog.csdn.net/jiuqiyuliang/article/details/48758203/    activeMQ 与spring整合

9、斜杠和反斜杠  " /"   斜杠一般用在linux下  而反斜杠在window下  因为window也能识别  /  所以最好使用斜杠

10、相对路径绝对路径 

  ./当前目录   /根目录 

  浏览器种的当前目录都是127.0.0.1   而不是127.0.0.1/webapp   所以在引用css js中需要request.getContextPath 这一项

11、rest方式,解决静态资源访问的两种方式

  <mvc:default-servlet-handler/>(SpringMVC3.0之后)  <mvc:resources mapping="/resources/**/" location="/resources/"/> 
  rest其实就是将参数和方法都写在了url中

12、redis 设置了path路径之后,就可以在cmd直接对redis进行操作了

13、泛型编程 http://www.cnblogs.com/lwbqqyumidi/p/3837629.html

   泛型是在jdk1.5提出来的,宽泛的类型编程,在类定义的时候加入泛型,实例化对象的时候,添加上相应的类型,这样在强制类型转换的时候,就可以在编译期显示异常,不用等到运行时才抛出异常,若实例化并没有赋予参数类型,那么泛型的定义便失去了意义

   泛型也可以编写泛型接口,泛型方法,提高代表的重用性

   泛型同时存在限制性泛型,利用extends关键字,可以限定类型参数只是某一类型

  

原文地址:https://www.cnblogs.com/happy0120/p/7581356.html