我在WEB-INF目录下已经考了struts-bean.tld文件,为什么浏览JSP时还找不到

时间:2021-11-15 11:31:18
错误信息:File "/WEB-INF/struts-bean.tld" not found

我已经在WEB-INF目录下考了*.TLD文件,为什么还是找不到这些文件?

多谢!

9 个解决方案

#1


............
见鬼了吧

#2


我的JSP文件在WEB-INF的上一级目录,是不是因为这样才没有找到呢?
请帮忙啊!

#3


在你的web.xml的末尾加上

  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>

#4


我的web.xml是这样的,已经包含了index.jsp中的三个.tld文件,他还是找不到.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<!-- Action Servlet Configuration -->
<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>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Application Tag Library Descriptor -->
<taglib>
<taglib-uri>/WEB-INF/app.tld</taglib-uri>
<taglib-location>/WEB-INF/app.tld</taglib-location>
</taglib>
<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
</web-app>

#5


看一看我的吧,若还不行,就是别的问题了。

<?xml version="1.0" encoding="UTF-8"?>
<!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>
  <context-param>
    <param-name>escore.config.path</param-name>
    <param-value>/WEB-INF/escore.xml</param-value>
  </context-param>
  
  <context-param>
    <param-name>log.config.path</param-name>
    <param-value>/WEB-INF/log.properties</param-value>
  </context-param>
  <context-param>
    <param-name>mailTemplate.dir.path</param-name>
    <param-value>/WEB-INF/mailTemplate</param-value>
  </context-param>
  
  <filter>
    <filter-name>loginFilter</filter-name>
    <filter-class>jp.go.maff.interactive.action.LoginFilter</filter-class>
  </filter>
  
  <filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>jp.go.maff.interactive.action.FormEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>Shift_JIS</param-value>
    </init-param>
  </filter>

  <filter-mapping>
    <filter-name>loginFilter</filter-name>
    <url-pattern>/</url-pattern>
  </filter-mapping>
  
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <servlet-name>action</servlet-name>
  </filter-mapping>
  
  <listener>
    <listener-class>jp.go.maff.interactive.common.WebConfigure</listener-class>
  </listener>

  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>ApplicationResources_ja</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>
   
   <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>


  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-template.tld</taglib-location>
  </taglib>
  
  <security-constraint>
      <web-resource-collection>
        <web-resource-name>S Resource</web-resource-name>
        <url-pattern>/web.jsp</url-pattern>
      </web-resource-collection>
  </security-constraint>

  <security-constraint>
      <web-resource-collection>
        <web-resource-name>S Resource</web-resource-name>
        <url-pattern>/*</url-pattern>
        <url-pattern>/</url-pattern>
      </web-resource-collection>
      <auth-constraint>
        <role-name>1</role-name>
        <role-name>2</role-name>
        <role-name>3</role-name>
      </auth-constraint>
  </security-constraint>
  
  <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
    <form-login-page>/login.jsp</form-login-page>
    <form-error-page>/loginError.jsp</form-error-page>
    </form-login-config>
  </login-config>
</web-app>

#6


你的jsp中是怎么写的?

#7


我的index.jsp是这样的。如果把三个标记库注释掉,就可以了,所以我怀疑是.tld的问题。

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<html:html locale="true">
<head>
<title><bean:message key="index.title"/></title>
<html:base/>
</head>
<body bgcolor="white">

<logic:notPresent name="database" scope="application">
  <font color="red">
    ERROR:  User database not loaded -- check servlet container logs
    for error messages.
  </font>
  <hr>
</logic:notPresent>

<logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application">
  <font color="red">
    ERROR:  Application resources not loaded -- check servlet container
    logs for error messages.
  </font>
</logic:notPresent>

<h3><bean:message key="index.heading"/></h3>
<ul>
<li><html:link page="/editRegistration.do?action=Create"><bean:message key="index.registration"/></html:link></li>
<li><html:link page="/logon.jsp"><bean:message key="index.logon"/></html:link></li>
</ul>

<p>&nbsp;</p>
<html:link page="/tour.do">
<font size="-1"><bean:message key="index.tour"/></font>
</html:link>
<p>&nbsp;</p>

<html:img page="/struts-power.gif" alt="Powered by Struts"/>

</body>
</html:html>

#8


你在jsp开始引用了吗?

#9


是我的web.xml文件的问题,里面多引用了下面这部分
<!-- Application Tag Library Descriptor -->
<taglib>
<taglib-uri>/WEB-INF/app.tld</taglib-uri>
<taglib-location>/WEB-INF/app.tld</taglib-location>
</taglib>

谢谢大家!!!

#1


............
见鬼了吧

#2


我的JSP文件在WEB-INF的上一级目录,是不是因为这样才没有找到呢?
请帮忙啊!

#3


在你的web.xml的末尾加上

  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>

#4


我的web.xml是这样的,已经包含了index.jsp中的三个.tld文件,他还是找不到.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<!-- Action Servlet Configuration -->
<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>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Application Tag Library Descriptor -->
<taglib>
<taglib-uri>/WEB-INF/app.tld</taglib-uri>
<taglib-location>/WEB-INF/app.tld</taglib-location>
</taglib>
<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
</web-app>

#5


看一看我的吧,若还不行,就是别的问题了。

<?xml version="1.0" encoding="UTF-8"?>
<!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>
  <context-param>
    <param-name>escore.config.path</param-name>
    <param-value>/WEB-INF/escore.xml</param-value>
  </context-param>
  
  <context-param>
    <param-name>log.config.path</param-name>
    <param-value>/WEB-INF/log.properties</param-value>
  </context-param>
  <context-param>
    <param-name>mailTemplate.dir.path</param-name>
    <param-value>/WEB-INF/mailTemplate</param-value>
  </context-param>
  
  <filter>
    <filter-name>loginFilter</filter-name>
    <filter-class>jp.go.maff.interactive.action.LoginFilter</filter-class>
  </filter>
  
  <filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>jp.go.maff.interactive.action.FormEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>Shift_JIS</param-value>
    </init-param>
  </filter>

  <filter-mapping>
    <filter-name>loginFilter</filter-name>
    <url-pattern>/</url-pattern>
  </filter-mapping>
  
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <servlet-name>action</servlet-name>
  </filter-mapping>
  
  <listener>
    <listener-class>jp.go.maff.interactive.common.WebConfigure</listener-class>
  </listener>

  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>ApplicationResources_ja</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>
   
   <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>


  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-template.tld</taglib-location>
  </taglib>
  
  <security-constraint>
      <web-resource-collection>
        <web-resource-name>S Resource</web-resource-name>
        <url-pattern>/web.jsp</url-pattern>
      </web-resource-collection>
  </security-constraint>

  <security-constraint>
      <web-resource-collection>
        <web-resource-name>S Resource</web-resource-name>
        <url-pattern>/*</url-pattern>
        <url-pattern>/</url-pattern>
      </web-resource-collection>
      <auth-constraint>
        <role-name>1</role-name>
        <role-name>2</role-name>
        <role-name>3</role-name>
      </auth-constraint>
  </security-constraint>
  
  <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
    <form-login-page>/login.jsp</form-login-page>
    <form-error-page>/loginError.jsp</form-error-page>
    </form-login-config>
  </login-config>
</web-app>

#6


你的jsp中是怎么写的?

#7


我的index.jsp是这样的。如果把三个标记库注释掉,就可以了,所以我怀疑是.tld的问题。

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<html:html locale="true">
<head>
<title><bean:message key="index.title"/></title>
<html:base/>
</head>
<body bgcolor="white">

<logic:notPresent name="database" scope="application">
  <font color="red">
    ERROR:  User database not loaded -- check servlet container logs
    for error messages.
  </font>
  <hr>
</logic:notPresent>

<logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application">
  <font color="red">
    ERROR:  Application resources not loaded -- check servlet container
    logs for error messages.
  </font>
</logic:notPresent>

<h3><bean:message key="index.heading"/></h3>
<ul>
<li><html:link page="/editRegistration.do?action=Create"><bean:message key="index.registration"/></html:link></li>
<li><html:link page="/logon.jsp"><bean:message key="index.logon"/></html:link></li>
</ul>

<p>&nbsp;</p>
<html:link page="/tour.do">
<font size="-1"><bean:message key="index.tour"/></font>
</html:link>
<p>&nbsp;</p>

<html:img page="/struts-power.gif" alt="Powered by Struts"/>

</body>
</html:html>

#8


你在jsp开始引用了吗?

#9


是我的web.xml文件的问题,里面多引用了下面这部分
<!-- Application Tag Library Descriptor -->
<taglib>
<taglib-uri>/WEB-INF/app.tld</taglib-uri>
<taglib-location>/WEB-INF/app.tld</taglib-location>
</taglib>

谢谢大家!!!