页面跳转小问题,帮者均有分,谢谢!
我在做一个用Tomact+struct开发的小项目时.出现一个让人十分郁闷的问题,我的
<welcome-file-list>
<welcome-file>newsmain.do</welcome-file>
</welcome-file-list>
怎么也不去执行newsmain.do动作.当我这样写时:<form action="newsmain.do" method="post">却可以执行newsmain.do动作.真搞不懂啊.我的配置文件如下:
web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>actionServlet</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
</servlet>
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>actionServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>newsmain.do</welcome-file>
</welcome-file-list>
</web-app>
struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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>
<form-beans>
</form-beans>
<global-forwards>
<forward name="toNewsMain" path="/index.jsp" />
</global-forwards>
<action-mappings>
<action path="/newsmain" type="news.MnewsAction" input="/error.jsp" /> </action-mappings>
</struts-config>