简体   繁体   中英

HTTP Status 500-/index.jsp “/struts-tags” not found

Hi Can anyone help me out to resolve the error mentioned above. I used a index.jsp file

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
        <%@ taglib prefix="s" uri="/struts-tags"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Hello World</title>
    </head>
    <body>
        <h1>Hello World From Struts2</h1>
       <form action="hello">
          <label for="name">Please enter your name</label><br/>
          <input type="text" name="name"/>
          <input type="submit" value="Say Hello"/>
       </form>
    </body>
    </html>

After writing all the classes and xml files,I have run the classes by tomcat server but got an error as follows 在此处输入图片说明

Can anyone help me out as I am new to Struts

The taglib is included in struts-core.jar, and the container will discover it automatically.

for some reason, a taglib configuration is needed within web.xml, extract the TLD file from the struts-core.jar META-INF folder, and add a taglib element to the web.xml.

 <!-- ... -->
    </welcome-file-list>

    <taglib>
       <taglib-uri>/s</taglib-uri>
       <taglib-location>/WEB-INF/struts-tags.tld</taglib-location>
    </taglib>
</web-app>

Try these:

  1. Seems like you copied the libraries manually and directly into the folder WEB-INF/lib of the project and eclipse doesn't sense them, I suggest that you copy any necessary libraries into WEB-INF/lib only through eclipse. I had this issue previously and only a refresh of the project solved the problem.
  2. add struts2-core.jar to the project download it here . Select Project and right click, Click on the properties, Click on libraries tab, Click on 'Add Jars', Add relevant jar for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM