在用 Struts的标签时  事先要把对应的标签的.tld格式文件要导入到项目的WEB/lib文件夹下面  还要配置struts-config.xml文件 你看看上面的文件有没有加载全  然后再看看 有没有配置好struts-config.xml文件  然后就应该没有问题了

解决方案 »

  1.   

    //把对应的标签的.tld格式文件要导入到项目的WEB/lib文件夹下面
    这个能详细解释下吗?谢谢 我照书上例子做的没有遇到这一步。还有以下是我的struts-config.xml文件,请问还需要配置什么吗?<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"><struts-config>
      <data-sources />
      <form-beans >
        <form-bean name="VipdataForm" type="com.fqf.formbean.VipdataForm" />  </form-beans>  <global-exceptions />
      <global-forwards />
      <action-mappings >
        <action
          attribute="VipdataForm"
          input="/AddVipData.jsp"
          name="VipdataForm"
          path="/AddVipdata"
          scope="request"
          type="com.fqf.action.AddVipdata" >
          <forward
            name="success"
            path="/AddVipData.jsp"
            contextRelative="true" />
        </action>
      </action-mappings>  <message-resources parameter="com.fqf.struts.ApplicationResources" />
    </struts-config>
      

  2.   

    配置标签库是在web.xml中的
    在jsp文件开头需要引入标签库
    <%@ taglib uri="/config/struts-html.tld" prefix="html" %>
      

  3.   

    jsp开头已经引入了标签库
    web.xml的配置不知道对不对,这是我的web.xml<?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      <servlet>
        <servlet-name>action</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>3</param-value>
        </init-param>
        <init-param>
          <param-name>detail</param-name>
          <param-value>3</param-value>
        </init-param>
        <load-on-startup>0</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>
    </web-app>
      

  4.   

    //把对应的标签的.tld格式文件要导入到项目的WEB/lib文件夹下面这个好像不是必须的吧?其实在struts.jar当中已经存储了tld的信息(在META-INF当中),所以在jsp当中,如果头部的导入tld的语句是按照tld内部的标准的写法就不必把tld文件导入到web/lib下面。