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

报404错误并且控制台毫无信息怎么办?

我按照视频中的在index.jsp中写了一个超链接,href="timer",然后写了TimerAction,重写了execute方法,最后在struts.xml中配置了,但是跳转到success.jsp页面的时候报了404错误并且控制台没有报错信息,我该怎么追踪呢?

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>Insert title here</title>
</head>
<body>
index,<a href="timer">执行action并计算执行时间</a>
</body>
</html>
package com.v3.action;

import com.opensymphony.xwork2.ActionSupport;

public class TimerAction extends ActionSupport {

    @Override
    public String execute() throws Exception {
        for(int i=0; i < 10000; i++){
            System.out.println("I LOVE V3");
        }
        return SUCCESS;
    }
    
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
    "http://struts.apache.org/dtds/struts-2.5.dtd">


<struts>
    <package name="default" namespace="/" extends="struts-default">
        <action name="timer" class="com.v3.action.TimerAction">
            <result>/success.jsp</result>
        </action>
    </package>
    
</struts>


正在回答

2 回答

朋友 你的问题解决了吗?

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

daydaylw3 提问者

解决了诶 0.0 编译的问题。。。
2016-09-07 回复 有任何疑惑可以回复我~

 <result>/success.jsp</result>  改成

 <result name=“success”>/success.jsp</result>  试试呢0.0

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

AsaLiu

没有作用
2016-08-02 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Struts2拦截器浅析
  • 参与学习       37983    人
  • 解答问题       118    个

本视频教程将代领大家了解Struts2拦截器的工作原理及配置

进入课程

报404错误并且控制台毫无信息怎么办?

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