在struts-config.xml里做好映射了么?
你程序里有么有Action?

解决方案 »

  1.   

    我的配置文件是这样的
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
        
        <!-- ========== Data Source Configuration =============================== -->
        <data-sources />
        
        <!-- ========== Form Bean Definitions ================================== -->
        <form-beans>
            <form-bean name="helloForm" type="com.javainthinking.struts.form.HelloForm">
                <form-property name="userName" type="java.lang.String" />
            </form-bean>
            
        </form-beans>
        
        <!-- ========== Global Exception Definitions ============================== -->
        <global-exceptions />
        
        <!-- ========== Global Forward Definitions =============================== -->
        <global-forwards>
            <forward name="Hello" path="/form/hello.jsp" />
            
        </global-forwards>
        
        <!-- ========== Action Mapping Definitions =============================== -->
        <action-mappings>
            <action
                attribute="helloForm"
                input="/form/hello.jsp"
                name="helloForm"
                path="/hello"
                type="com.javainthinking.struts.action.HelloAction" />
            
        </action-mappings>
        
        <!-- ========== Controller Configuration ================================ -->
        <controller />
        
        <!-- ========== Message Resources Definitions ============================ -->
        <message-resources parameter="com.javainthinking.struts.ApplicationResources" />
        
        <!-- ========== Plug Ins Configuration ================================= -->
    </struts-config>