struts-config.xml没有配置好吧。

解决方案 »

  1.   

    struts-config.xml
    配置文件如下:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
    <struts-config>
      <form-beans>
        <form-bean name="welcomeActionForm" type="mystruts.WelcomeActionForm" />
      </form-beans>
      <global-forwards>
        <forward name="welcome" path="welcome.jsp" />
      </global-forwards>
      <action-mappings>
        <action name="welcomeActionForm" path="/welcomeAction" scope="request" type="mystruts.WelcomeAction" validate="false" />
      </action-mappings>
      <plug-in className="org.apache.struts.tiles.TilesPlugin">
        <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
      </plug-in>
    </struts-config>
      

  2.   

    按你的struts-config.xml,应该是 /welcomeAction.do才能找到资源的。
      

  3.   

    <action-mappings>
        <action name="welcomeActionForm" path="/welcomeAction" scope="request" type="mystruts.WelcomeAction" validate="false" />
      </action-mappings>
    中的path="/welcomeAction" 改成了path="/welcomeAction.do" 也不行呢我是菜鸟,请各大侠多帮忙啊。
      

  4.   

    <action-mappings>
        <action name="welcomeActionForm" path="/welcomeAction" scope="request" type="mystruts.WelcomeAction" validate="false" />
      </action-mappings>
    把path改成path = "/mystrutsapp/welcomeAction"就行了
      

  5.   

    welcomeAction.do无效你配置一下STRUTS-CONFIG.XML中<action-mappings>
        <action name="welcomeActionForm" path = "/mystrutsapp/welcomeAction" scope="request" type="mystruts.WelcomeAction" validate="false" />
      </action-mappings>
      

  6.   

    以下是WelcomeAction.java的代码。我估计是路径错误了,<action-mappings>
        <action name="welcomeActionForm" path="/welcomeAction" scope="request" type="mystruts.WelcomeAction" validate="false" />
      </action-mappings>
    把path改成path = "/mystruts/welcomeAction" 仍旧不行。晕
    package mystruts;import org.apache.struts.action.*;
    import javax.servlet.http.*;public class WelcomeAction extends Action {
      public ActionForward perform(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
        /**@todo: complete the business logic here, this is just a skeleton.*/
        HttpSession session = httpServletRequest.getSession(false);
        String username  = ((WelcomeActionForm) actionForm).getUsername();
        session.setAttribute("username", username);
        System.out.println(username);
        return (actionMapping.findForward("welcome"));
      }
    }