配置如下:
<?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"><web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    <servlet>
        <servlet-name>webwork</servlet-name>
        <servlet-class>com.opensymphony.webwork.dispatcher.ServletDispatcher</servlet-class>
    </servlet>    <servlet-mapping>
        <servlet-name>webwork</servlet-name>
        <url-pattern>*.action</url-pattern>
    </servlet-mapping>
</web-app>
提示错误如下:
严重: Parse Fatal Error at line -1 column -1: Premature end of file.
org.xml.sax.SAXParseException: Premature end of file.严重: Parse error in application web.xml
org.xml.sax.SAXParseException: Premature end of file.

解决方案 »

  1.   

    哥们<url-pattern> *.action </url-pattern> 
    这个前面加上/
    <url-pattern> /*.action </url-pattern> 
      

  2.   

    <!DOCTYPE   web-app   PUBLIC   "-//Sun   Microsystems,   Inc.//DTD   Web   Application   2.3//EN"   "http://java.sun.com/dtd/web-app_2_3.dtd"> 删除掉xmlns="http://java.sun.com/xml/ns/j2ee" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
            version="2.4"
    也删除掉,试一试
      

  3.   

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
            <servlet>
        <servlet-name>webwork</servlet-name>
        <servlet-class>com.opensymphony.webwork.dispatcher.ServletDispatcher</servlet-class>
    </servlet>
            <servlet-mapping>
    <servlet-name>webwork</servlet-name>
    <url-pattern>/*.action</url-pattern>
    </servlet-mapping>
    </web-app>
    可能是全角半角的事,把我的拷上试试,替换你的web.xml
      

  4.   

    看看你的web.xml内容是否写的有问题?
      

  5.   

    <web-app   xmlns="http://java.sun.com/xml/ns/j2ee" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
            version="2.4"> 
    把上面这个删掉,这个是DTD格式问题 ,可以删掉,写成
    <web-app>
    再看看提示什么问题
      

  6.   

    你这个web.xml比较简单,直接从tomcat里找个覆盖就得了!xml有很多细节,一不小心就会引起问题!