为了账号安全,请及时绑定邮箱和手机立即绑定

学生列表界面404,这个错误怎么解决?

2019-03-12 15:43:16,727 WARN  [http-nio-8080-exec-4] log4j2.Log4j2Logger (Log4j2Logger.java:65) - Could not find action or result: /imooc_sh/students/Students_query.action
com.opensymphony.xwork2.config.ConfigurationException: No result defined for action action.StudentsAction and result Students_query_success
    at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:374) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:276) ~[xwork-core-2.3.37.jar:2.3.37]
    at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41) ~[struts2-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) ~[struts2-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:168) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) ~[xwork-core-2.3.37.jar:2.3.37]
    at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76) ~[struts2-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73) ~[struts2-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:125) ~[struts2-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) ~[struts2-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:253) ~[struts2-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:140) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) ~[struts2-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189) ~[xwork-core-2.3.37.jar:2.3.37]
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) ~[xwork-core-2.3.37.jar:2.3.37]
    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) ~[struts2-core-2.3.37.jar:2.3.37]
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:575) [struts2-core-2.3.37.jar:2.3.37]
    at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81) [struts2-core-2.3.37.jar:2.3.37]
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) [struts2-core-2.3.37.jar:2.3.37]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.38]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.38]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) [catalina.jar:8.5.38]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:8.5.38]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) [catalina.jar:8.5.38]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:8.5.38]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [catalina.jar:8.5.38]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650) [catalina.jar:8.5.38]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.38]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [catalina.jar:8.5.38]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800) [tomcat-coyote.jar:8.5.38]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.38]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) [tomcat-coyote.jar:8.5.38]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-coyote.jar:8.5.38]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.38]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_191]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_191]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.38]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_191

//StudentsAction

package action;

import java.text.SimpleDateFormat;
import java.util.List;

import entity.Students;
import service.impl.StudentsDAOImpl;
import services.StudentsDAO;

//学生Action类
public class StudentsAction extends SuperAction{

    private static final long serialVersionUID = 1L;
    
    //查询所有学生的动作
    public String query() {
        //首先创建学生业务逻辑接口的引用
        StudentsDAO sdao = new StudentsDAOImpl();
        //调用sdao的一个方法,返回一个List的集合
        List<Students> list = sdao.queryAllStudents();
        //将结果放进session中
        if(list!=null&&list.size()>0) {
            session.setAttribute("students_list", list);
            //return "Students_query_success";
        }
        return "Students_query_success";
    }
    
    //添加学生
    public String add() throws Exception{
         Students s = new Students();
         s.setSname(request.getParameter("sname"));
         s.setGender(request.getParameter("gender"));
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         s.setBirthday(sdf.parse(request.getParameter("birthday")));
         s.setAddress(request.getParameter("address"));
         StudentsDAO sdao = new StudentsDAOImpl();
         sdao.addStudents(s);
         return "add_success";
    }
}
<!-- struts.xml -->

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
    "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>

    <package name="default" namespace="/" extends="struts-default">
      
    </package>
    
    <package name="users" namespace="/users" extends="default">
      <action name="*_*" class="action.{1}Action" method="{2}">
        <result name="login_success">/users/Users_login_success.jsp</result>
        <result name="login_failure">/users/Users_login.jsp</result>
        <result name="logout_success">/users/Users_login.jsp</result>
        <result name="input">/users/Users_login.jsp</result>
      </action>
    </package>
    
    <package name="students" namespace="/students" extends="default" >
      <action name="*_*" class="action.{1}Action" method="{2}">
        <result name="query_success">/students/Students_query_success.jsp</result>
      </action>
    </package>
</struts>


正在回答

1 回答

http://img1.sycdn.imooc.com//5d89e14b0001d7ff03860275.jpghttp://img1.sycdn.imooc.com//5d89e18f0001186506280120.jpg应该是这样

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

学生列表界面404,这个错误怎么解决?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信