<?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">
    <display-name>springstruts</display-name>  <servlet>
    <servlet-name>login</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>    <load-on-startup>2</load-on-startup>
  </servlet>
  <!-- Action Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>login</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>    <taglib>
        <taglib-uri>/tags/struts-html</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-html.tld</taglib-location>
    </taglib>
        <taglib>
        <taglib-uri>/tags/struts-bean</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>
    </taglib>    <taglib>
        <taglib-uri>/tags/struts-logic</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-logic.tld</taglib-location>
    </taglib>
       <taglib>
        <taglib-uri>/tags/struts-tiles</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-tiles.tld</taglib-location>
    </taglib>
</web-app>

解决方案 »

  1.   

    关键点是,web.xml 中各种元素的出现是有先后顺序的。
      

  2.   

    目錄下有這個嗎?
    WEB-INF/struts-logic.tld
      

  3.   

    呵呵,我把你复制到web.xml里面,
    就是编辑器在<taglib>这里打了个红叉,提示:
    invalid content was found starting with element 'taglib'.
      

  4.   

    目錄下有這個嗎?
    WEB-INF/struts-logic.tld
    -------------------------
    有的啊!
      

  5.   

    你把我的完全复制进去当然有错,
    <taglib-location>/WEB-INF/tlds/struts-tiles.tld</taglib-location>
    这里面的路径要换成你的
      

  6.   

    <taglib>
        <taglib-uri>/WEB-INF/struts-bean</taglib-uri>
        <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>/WEB-INF/struts-html</taglib-uri>
        <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>/WEB-INF/struts-logic</taglib-uri>
        <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>/WEB-INF/struts-nested</taglib-uri>
        <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
      </taglib>
    ------------------------------------------------------------------
    问题是这个就是我的路径啊!