Mr.Zhang8743 2017-10-27 11:39 采纳率: 0%
浏览 1553

action在Struts2中配置了,但是点击超链接的时候没有跳转到指定页面

action类

package zww.com.domain;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;

public class TestActionContextAction {

public String execute(){

    System.out.println("success");
    return "success";
}

}

struts.xml的配置

<?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">


method="execute">
/test-ContextAction.jsp

</package>

<!-- 请求参数的编码方式 -->
<constant name="struts.i18n.encoding" value="UTF-8" />
<!-- 指定被struts2处理的请求后缀类型。多个用逗号隔开 -->
<constant name="struts.action.extension" value="action,do,go,qqi" />
<!-- 当struts.xml改动后,是否重新加载。默认值为false(生产环境下使用),开发阶段最好打开 -->
<constant name="struts.configuration.xml.reload" value="true" />
<!-- 是否使用struts的开发模式。开发模式会有更多的调试信息。默认值为false(生产环境下使用),开发阶段最好打开 -->
<constant name="struts.devMode" value="false" />
<!-- 设置浏览器是否缓存静态内容。默认值为true(生产环境下使用),开发阶段最好关闭 -->
<constant name="struts.serve.static.browserCache" value="false" />
<!-- 指定由spring负责action对象的创建 <constant name="struts.objectFactory" value="spring"/> -->
<!-- 是否开启动态方法调用 -->
<constant name="struts.enable.DynamicMethodInvocation" value="false" />

点击的超链接




Insert title here


testAction

跳转到的页面信息




Insert title here


TestContextAction


  • 写回答

1条回答 默认 最新

  • 软件求生 2017-11-09 02:22
    关注

    struts.xml的配置文件,你把文件展示完整一些。
    你可以在action类上打一个断点,以debug模式启动项目。
    看看是否进入到action类。

    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试