• <legend id='pebXd'><style id='pebXd'><dir id='pebXd'><q id='pebXd'></q></dir></style></legend>
      <bdo id='pebXd'></bdo><ul id='pebXd'></ul>

  • <small id='pebXd'></small><noframes id='pebXd'>

      <i id='pebXd'><tr id='pebXd'><dt id='pebXd'><q id='pebXd'><span id='pebXd'><b id='pebXd'><form id='pebXd'><ins id='pebXd'></ins><ul id='pebXd'></ul><sub id='pebXd'></sub></form><legend id='pebXd'></legend><bdo id='pebXd'><pre id='pebXd'><center id='pebXd'></center></pre></bdo></b><th id='pebXd'></th></span></q></dt></tr></i><div id='pebXd'><tfoot id='pebXd'></tfoot><dl id='pebXd'><fieldset id='pebXd'></fieldset></dl></div>

        <tfoot id='pebXd'></tfoot>

      1. Java Struts2(找不到动作类)

        时间:2023-09-25

        <legend id='z38nE'><style id='z38nE'><dir id='z38nE'><q id='z38nE'></q></dir></style></legend>

          <tbody id='z38nE'></tbody>

            • <bdo id='z38nE'></bdo><ul id='z38nE'></ul>
              <i id='z38nE'><tr id='z38nE'><dt id='z38nE'><q id='z38nE'><span id='z38nE'><b id='z38nE'><form id='z38nE'><ins id='z38nE'></ins><ul id='z38nE'></ul><sub id='z38nE'></sub></form><legend id='z38nE'></legend><bdo id='z38nE'><pre id='z38nE'><center id='z38nE'></center></pre></bdo></b><th id='z38nE'></th></span></q></dt></tr></i><div id='z38nE'><tfoot id='z38nE'></tfoot><dl id='z38nE'><fieldset id='z38nE'></fieldset></dl></div>
              <tfoot id='z38nE'></tfoot>

              <small id='z38nE'></small><noframes id='z38nE'>

                1. 本文介绍了Java Struts2(找不到动作类)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我得到的错误.前一天运行良好,但今天打开时出现以下错误.

                  The error which I am getting. It was running all fine a day before but when open it today I get the following errors.

                  Action class [com.tutorialspoint.struts2.HelloWorldAction] not found - action - file:/C:/Users/sai/Struts2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HelloWorldStruts2/WEB-INF/classes/struts.xml:10:30
                      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:374)
                      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:329)
                      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:429)
                      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:239)
                      at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
                      at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:152)
                      at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
                      at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
                      at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
                      at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:205)
                      at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
                      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
                      at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
                      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4828)
                      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5508)
                      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
                      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
                      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
                      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
                      at java.lang.Thread.run(Thread.java:745)
                  

                  我的 index.jsp 页面

                  <%@ 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>
                  <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>
                  

                  我的 struts.xml 文件

                  <?xml version="1.0" encoding="UTF-8"?>
                  <!DOCTYPE struts PUBLIC
                     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
                     "http://struts.apache.org/dtds/struts-2.0.dtd">
                     <struts>
                        <constant name="struts.devMode" value="true" />
                        <package name="helloworld" extends="struts-default">
                           <action name="hello" 
                              class="com.tutorialspoint.struts2.HelloWorldAction"
                              method="execute">
                              <result name="success">/HelloWorld.jsp</result>
                              <result name="error">/AccessDenied.jsp</result>
                           </action>
                        </package>
                  </struts>
                  

                  动作映射 ---- 我尝试将 hello 作为动作名称并将 hello.action 作为动作名称,但得到相同的错误

                  The action mapping ---- I tried hello as action name and also hello.action as action name but got the same error

                  我的 web.xml 文件

                  <?xml version="1.0" encoding="UTF-8"?>
                  <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xmlns="http://java.sun.com/xml/ns/javaee" 
                     xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
                     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
                     http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
                     id="WebApp_ID" version="3.0">
                  
                     <display-name>Struts 2</display-name>
                     <welcome-file-list>
                        <welcome-file>index.jsp</welcome-file>
                     </welcome-file-list>
                     <filter>
                        <filter-name>struts2</filter-name>
                        <filter-class>
                           org.apache.struts2.dispatcher.FilterDispatcher
                        </filter-class>
                     </filter>
                  
                     <filter-mapping>
                        <filter-name>struts2</filter-name>
                        <url-pattern>/*</url-pattern>
                     </filter-mapping>
                  </web-app>
                  

                  即使在清理项目重新部署它并再次重新启动服务器之后,我也无法消除错误.

                  Even after cleaning the project redeploying it and again restarting the server I was not able to remove the error.

                  推荐答案

                  Struts2 XML 配置提供程序无法加载动作类.此类 com.tutorialspoint.struts2.HelloWorldAction 在类路径中不可用或已损坏.您使用的版本太旧,需要重新创建项目并更新xml配置文件struts.xmlweb.xml中的版本信息.

                  Struts2 XML configuration provider cannot load the action class. This class com.tutorialspoint.struts2.HelloWorldAction is not available on the classpath or corrupted. The version are you using is too old, and you need to recreate the project and update version information in xml configuration files struts.xml, web.xml.

                  请参阅 如何创建一个Struts 2 Web 应用程序.

                  这篇关于Java Struts2(找不到动作类)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:&lt;s:选择&gt;具有动态列表名称 下一篇:使用值“[Ljava.lang.String;@10dd65e"设置表达式“spa.amount"时

                  相关文章

                2. <small id='jjse9'></small><noframes id='jjse9'>

                  <legend id='jjse9'><style id='jjse9'><dir id='jjse9'><q id='jjse9'></q></dir></style></legend>
                    • <bdo id='jjse9'></bdo><ul id='jjse9'></ul>

                  1. <tfoot id='jjse9'></tfoot>

                    <i id='jjse9'><tr id='jjse9'><dt id='jjse9'><q id='jjse9'><span id='jjse9'><b id='jjse9'><form id='jjse9'><ins id='jjse9'></ins><ul id='jjse9'></ul><sub id='jjse9'></sub></form><legend id='jjse9'></legend><bdo id='jjse9'><pre id='jjse9'><center id='jjse9'></center></pre></bdo></b><th id='jjse9'></th></span></q></dt></tr></i><div id='jjse9'><tfoot id='jjse9'></tfoot><dl id='jjse9'><fieldset id='jjse9'></fieldset></dl></div>