公司框架学习笔记 二

  公司的培训是结束了,感觉比较迷糊,今天没什么事情,开始新的学习~程序启动的时候首先加载的是web.xml,今天好好看看web.xml

  <?xml version="1.0" encoding="ISO-8859-1"?>,这个代表的是版本和编码格式。

  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application  2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

  Doctype:document type

  web-app:root element for this docment,这个.....

  public URL:表示对外部DTD文件的引用,DTD,document type definition,文档类型定义

 

  从服务器端发送来的文档在客户端被解析,那么这就和浏览器有关系了,那么浏览器是怎么样发挥作用的?浏览器的内置对象有Document,Window,History,Location~但是现在好像和这些没什么直接关系。

  在浏览器里面有XML解析器,对于XML文件有一个加载-->解析的顺序,在w3school.com.cn找到了一些资料,拿IE做练习,遇到这么一些javascript代码:

 

 

代码
try //Internet Explorer
  {
  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  }
catch(e)
  {
  try //Firefox, Mozilla, Opera, etc.
    {
    xmlDoc=document.implementation.createDocument("","",null);
    }
  catch(e) {alert(e.message)}
  }
try 
  {
  xmlDoc.async=false;
  xmlDoc.load("/example/xdom/books.xml");
  document.write("xmlDoc is loaded, ready for use");
  }
catch(e) {alert(e.message)}

 

 

  题外话:netscape发明了javascript,也有他自己的浏览器,资本追求利益是天性使然,发明了js也避免不了是为了当初的网景浏览器服务,但是在随后的市场中输给了IE,现在在大陆还有遨游,360等等大量浏览器的存在~由于技术创新不具有连续性,感觉浏览器同质化竞争愈来愈是激烈~功能总是越来越相似,如何在这样的市场中生存下去,提高浏览器本身的速度,效率等等做法是值得让人尊敬的,但是周期的长短很重要,所以当初微软采用了捆绑IE的办法,直到现在,很多人都习惯了IE,IE本身也成了浏览器的一个标志性符号。

  对于软件来说,选择一个人们喜欢的方式去推广很重要,依靠用户之间的推广很原始但是很多人还是在用,但是一般的软件也很难有资金去做好的广告,真应该想一些其他的方式,花在营销上的时间和方法是同等重要的,或许我们应该去营销的黄埔军校--宝洁去看看~~哈哈

 

  瞎扯一番,对这些东西也不怎么了解,下面继续看书。

  在上面的js代码执行结束之后,相应的XML内容加载到了 xmlDoc这个对象里面~这里面还有一些限制,例如不能跨域加载。

  上午在照着例子做完了之后,似乎是明白了一些什么。

  直接打开web-app_2_3.dtd,首先是一长串的版权声明下面的,貌似还有法语?反正不是德语,没有一个认识的德语单词。。

  

  首先进入视线的是

  <web-app>:The web-app element is the root of the deployment descriptor for a web application.

  然后在我的配置文件里面是:

   <context-param>:The context-param element contains the declaration of a web application's servlet context initialization parameters.  有param-name和para-value俩个主要的属性

  其次:

  <filter>:Declares a filter in the web application. The filter is mapped to either a servlet or a URL pattern in the filter-mapping element, using the filter-name value to reference. Filters can access the initialization parameters declared in the deployment descriptor at runtime via the FilterConfig interface.

  中文译作过滤器,copy来

<filter>'s children
Name Cardinality
description One or none
display-name One or none
filter-class Only one
filter-name Only one
icon One or none
init-param Any number


  然后是 <filter-mapping>:Declaration of the filter mappings in this web application. The container uses the filter-mapping declarations to decide which filters to apply to a request, and in what order. 

  The container matches the request URI to a Servlet in the normal way. To determine which filters to apply it matches filter-mapping declarations either on servlet-name, or on url-pattern for each filter-mapping element, depending on which style is used. The order in which filters are invoked  is the order in which filter-mapping declarations that  match a request URI for  a servlet appear in the list of filter-mapping elements.The filter-name value must be the value of the <filter-name> sub-elements of one of the <filter> declarations in the deployment descriptor.

  在这个web.xml里面有不仅仅有一个filter-mapping,在调用filter的时候 其实不是由servlet-name或者url-pattern决定的,而是根据不同的方式来调用,这个顺序是按照在与过滤器映射声明中的  一个在过滤器映射元素表中出现的servlet  相匹配的。。。。没能翻译出来,不理解,先记下,以后遇到了注意。。。

 

  下一个看见了 <listener>:The listener-class element declares a class in the application must be registered as a web application listener bean. The value is the fully qualified classname of the listener class(完整合法的**类名).

 

  <servlet>:The servlet element contains the declarative data of a servlet. If a jsp-file is specified and the load-on-startup element is present, then the JSP should be precompiled and loaded.  如果一个jsp文件被指定并且在load-on-startup这个元素会表现出来(confusing...>_<),JSP文件将会被预编译并且加载~

<servlet>'s children
Name Cardinality
description One or none
display-name One or none
icon One or none
init-param Any number
jsp-file One or none
load-on-startup One or none
run-as One or none
security-role-ref Any number
servlet-class One or none
servlet-name Only one

 

  <session-config>:session-timeout  ---> This session-config element defines the session parameters for this web application

  <mime-mapping>:

     <mime-mapping>
        <extension>wsdl</extension>    //wsdl:WSDL :Web Services Description Language。WSDL 是一种使用 XML 编写的文档。这种文档可描述某个 Web service。它可规定服务的位置,以及此服务提供的操作(或方法)。貌似WSDL后面又有很多东西,pass掉
        <mime-type>text/xml</mime-type> //一种格式?
     </mime-mapping>

 

  最后是 <taglib>:used to describle a jsp-tag-library~location and URL contained

  

   这个web.xml就看完了,休息一会

 

 

 

  

posted @ 2010-08-04 14:25  8830  阅读(244)  评论(0编辑  收藏  举报