怎样实现从一个Action 跳到另一个Action里例:
UserLoginAction.java 跳到另一个TopicListAction里代码:
package com.xiaotang.bbs.userAction;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;import com.xiaotang.bbs.db.DB;
import com.xiaotang.bbs.userForm.UserLogForm;
import com.xiaotang.bbs.userdao.UserLogDao;/**
 * @author xiaotang E-mail: [email protected]
 * @version1.00 创建时间:Feb 20, 2009 8:56:07 PM 类说明:
 */public class UserLoginAction extends Action { @Override
public ActionForward execute(ActionMapping map, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// TODO Auto-generated method stub
String username = null;
String password = null;
String forward = null;
UserLogDao usLoDao = new UserLogDao();
UserLogForm user = (UserLogForm) form;
username = user.getUsername();
System.out.println("Ausername" + username);
password = user.getPassword();
System.out.println("Apassword" + password);
System.out.println("??="
+ usLoDao.checkUser(new DB(), username, password)); if (usLoDao.checkUser(new DB(), username, password)) { forward = "topicList.do";
} return map.findForward(forward);
}}
-----------------------------------------------------------------------------------
package com.xiaotang.bbs.userAction;import java.util.List;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;import com.xiaotang.bbs.userdao.TopicListDao;/** 
 * @author xiaotang  E-mail: [email protected] 
 * @version1.00  创建时间:Feb 24, 2009 11:01:03 PM 
 * 类说明:
 */public class TopicListAction extends Action { @Override
public ActionForward execute(ActionMapping map, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// TODO Auto-generated method stub
TopicListDao tld=new TopicListDao();
List list=tld.serach();
request.setAttribute("list", list);
return map.findForward("topiclist");
}}
----------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>
<data-sources />
<form-beans>
<form-bean name="UserLogForm"
type="com.xiaotang.bbs.userForm.UserLogForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings>
<action path="/login"
type="com.xiaotang.bbs.userAction.UserLoginAction" name="UserLogForm"
scope="session" input="/user/login.jsp">
<forward name="topiclist" path="/user/topicList.do"></forward>

</action>
<action path="/topicList"
type="com.xiaotang.bbs.userAction.TopicListAction">
<forward name="topiclist" path="/user/topic.jsp"></forward>
<forward name="faile" path="/user/MyJsp1.jsp"></forward>
</action>
</action-mappings>
<message-resources
parameter="com.xiaotang.bbs.adminAction.ApplicationResources" />
</struts-config>-------------------------------------------------------------------------------------
login.do转到UserLoginAction.java然后在UserLoginAction中通过topicList.do找到TopicListAction
错误:
2009-2-25 17:31:38 org.apache.struts.action.ActionMapping findForward
警告: Unable to find 'topicList.do' forward.
==============================================================================
为什么找不到'topicList.do'