2 qq 31805347 qq_31805347 于 2016.04.16 20:32 提问

初学struts,helloWorld都出不来,求大神帮忙,谢谢~

package sjzc;

import com.opensymphony.xwork2.ActionSupport;

public class HelloWorldAction extends ActionSupport {

@Override
// String 视图的路径
public String execute() throws Exception {
    System.out.println("执行Action");
    return SUCCESS;
}

}

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

<package name="default" namespace="/" extends="struts2-default">

    <action name="helloworld" class="sjzc.HellowWorldAction">
        <result name="" type="">/result.jsp </result>
    </action>
</package>

web.xml
<?xml version="1.0" encoding="UTF-8"?>
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">


struts2

org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter



struts2
/*

5个回答

CSDNXIAON
CSDNXIAON   2016.04.16 20:42

求大神帮忙新手初学
----------------------同志你好,我是CSDN问答机器人小N,奉组织之命为你提供参考答案,编程尚未成功,同志仍需努力!

caozhy
caozhy   Ds   Rxr 2016.04.16 20:36
ccnn_yanan
ccnn_yanan   2016.05.31 21:42

struts.xml 配置文件 result “SUCCESS”不要type

oyh1203
oyh1203   2016.06.23 10:53

/result.jsp

t1012665655
t1012665655   2016.11.05 17:29

name,type不要,或name="success"

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!