试试return new ActionForward("/test/HelloWorld1.htm");

解决方案 »

  1.   

    return new ActionForward(str);中的str只是一个在strut-config文件中actionMapping定义个一个forward的一个影射而已。也就是说你的"/HelloWorld1.htm"必须在actionMapping中有定义,而其转向的页面并不一定是/HelloWorld1.htm,也许是www.sohu.com哪:)
      

  2.   

    to: lj0425(冰芝麻) 
    不好意思,应该怎么映射呢?
      

  3.   

    <action-mappings>
    <action path="/HelloWorld1"
              type="HelloWorld1Action">
           <forward name="HelloWorld1.htm" path="/HelloWorld1.htm"/>
           <forward name="failure" path="/login.jsp"/>
         </action>
    </action-mappings>
    这样映射了还是不行
      

  4.   

    一般情况下并不需要return new ActionForward的形式吧,若在struts_config.xml有映射定义的话,用ActionMapping.findForward方法
      

  5.   

    在struts-config.xml中这样映射:<action path="/HelloWorld1"
               type="presentation.HelloWorld1Action">
               <forward name="HelloWorld1" path="http://www.sohu.com"/>
                     </action>
      
    HelloWorld1Action类中这样写:public ActionForward execute(
            ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response)
            throws Exception {
    System.out.println("helloworld1");
    return mapping.findForward("HelloWorld1");   
    }
    也不行