java--xml constraints, tomcat server

xml constraints

XML Grammar: The basic rules for writing standard xml files. (developed by the w3c organization)

XML Constraints: Write rules that standardize the data content format of XML files. (Defined by the developer)

DTD constraints

DTD constraints: the syntax is relatively simple, and the function is relatively simple. The cost of learning is also low.

DTD syntax

Constraint labels

<!ELEMENT 元素名称 类别>  或 <!ELEMENT 元素名称 (元素内容)>

category:

空标签: EMPTY。 表示元素一定是空元素。
普通字符串: (#PCDATA)。表示元素的内容一定是普通字符串(不能含有子标签)。
任何内容: ANY。表示元素的内容可以是任意内容(包括子标签) 

Order question:

<!ELEMENT 元素名称(根元素) (子元素名称 1,子元素名称 2,.....)>: 按顺序出现子标签

Number of times problem:

标签   :  必须且只出现1次。
标签+  : 至少出现1次
标签*   : 0或n次。
标签?  : 0 或1次。

Constraint properties

<!ATTLIST 元素名称 属性名称 属性类型 默认值>

Defaults:

#REQUIRED 属性值是必需的 
#IMPLIED   属性不是必需的 
#FIXED value 属性不是必须的,但属性值是固定的

Attribute Type: Controls the value of the attribute

CDATA :表示普通字符串 
(en1|en2|..): 表示一定是任选其中的一个值
ID:表示在一个xml文档中该属性值必须唯一。值不能以数字开头

import dtd method

Internal import

<!DOCTYPE note(根元素) [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to      (#PCDATA)>
<!ELEMENT from    (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
 <!ELEMENT body    (#PCDATA)>
]>

external import

本地文件系统:         

<!DOCTYPE note(根元素) SYSTEM "note.dtd(文件名)">

公共的外部导入:

<!DOCTYPE 根元素 PUBLIC "http://gz.itcast.cn/itcast.dtd">

Schema constraints

Schema constraints: The syntax is relatively complex and the functions are relatively powerful. The cost of learning is relatively high! ! ! (emphasis: namespaces)

For specific use, please refer to the user manual of the w3school website

Basic use of Tomcat

Start the software

a)找到%tomcat%/bin/startup.bat ,双击这个文件
b)弹出窗口,显示信息(不要关闭次窗口)
c)打开浏览器,输出以下地址
    http://localhost:8080
d)看到一只猫画面,证明软件启动成功!

close the software

a)找到%tomcat%/bin/shutdown.bat,双击这个文件即可!
c)打开浏览器,输出以下地址。看到“无法连接”(最好先清空浏览器缓存)

Common problems in the use of tomcat software

Flashback problem

Reason: tomcat software is developed in java language. When the tomcat software starts, it will look for a variable named JAVA_HOME in the environment variables of the system by default. The role of this variable finds the jvm required for tomcat to start.

Solution; Set the variable JAVA_HOME in the environment variable JAVA_HOME= C:\Program Files\Java\jdk1.6.0_30 (be careful not to configure it in the bin directory)

Port occupied error

Solution:

a)关闭其他软件程序,释放所需端口

b)修改tomcat软件所需端口 找到并修改%tomcat%/conf/server.xml文件

<Connector port="8081" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" />

CATALINA environment variable problem

Reason: After the tomcat software is started, in addition to looking for JAVA_HOME, it will also look for a variable called CATALINA_HOME. The function of this variable is to set the root directory of tomcat

Solution: It is recommended not to set the CATALINA_HOME variable. Check if any, clear it! ! !

Tomcat's directory structure

|-bin: Store tomcat commands.
catalina.bat command:
startup.bat -> catalina.bat start
shutdown.bat -> catalina.bat stop

|- conf: Store the configuration information of tomcat. The server.xml file is the core configuration file.

|-lib: The jar package that supports tomcat software running. There are also technical support packages, such as servlet, jsp

|-logs: log information of the running process

|-temp: temporary directory

|-webapps: Shared resource directory. web application directory. (Note that it cannot be shared as a separate file)

|-work: The running directory of tomcat. Temporary files generated when jsp is running are stored here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324890142&siteId=291194637