添加了spring 要怎么配置web.xml文件,自己添加了老是出现空指针异常啊,

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【ansha886】截止到2008-08-03 11:34:00的历史汇总数据(不包括此帖):
    发帖的总数量:62                       发帖的总分数:360                      每贴平均分数:5                        
    回帖的总数量:44                       得分贴总数量:2                        回帖的得分率:4%                       
    结贴的总数量:59                       结贴的总分数:300                      
    无满意结贴数:47                       无满意结贴分:1120                     
    未结的帖子数:3                        未结的总分数:60                       
    结贴的百分比:95.16 %               结分的百分比:83.33 %                  
    无满意结贴率:79.66 %               无满意结分率:373.33%                  
    值得尊敬

    取消马甲机器人,请点这里:http://www.java2000.net/mycsdn/robotStop.jsp?usern=ansha886
      

  2.   

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/classes/applicationContext.xml</param-value>
    </context-param><servlet>
        <servlet-name>context</servlet-name>
        <servlet-class>spring-web包的ContextLoaderServlet类</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
      

  3.   

           [align=left] <context-param>
    <param-name>ContextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param> <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListener
    </listener-class>
    </listener>[/align]
      

  4.   

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:spring/*.xml</param-value>
    </context-param>
    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListener
    </listener-class>
    </listener>src/spring文件夹下的所有包都被配置进去
      

  5.   

    <context-param> 
      <param-name>ContextConfigLocation </param-name> 
      <param-value>/WEB-INF/applicationContext.xml </param-value> 
    </context-param> <listener> 
     <listener-class> 
      org.springframework.web.context.ContextLoaderListener 
     </listener-class> 
    </listener>
      

  6.   

    这是一种监听机制,Spring用来做WEB开发,就必须放在WEB容器下利用,当WEB 有请求业务,Spring就会积极相应。web.xml实际上就是个环境,你得把它放入到这个环境中去,此为我个人在开发中的领悟,敬请指教!