学习struts遇到的简单问题!
程序功能:
在hello.jsp中点击超联接转到HelloWorld_1.jsp或 HelloWorld_2.jsp
hello.jsp代码:
<html>
<body>
<a href= "/HelloWorld.do?place=1 "> HelloWorld_1 </a>
<a href= "/HelloWorld.do?place=2 "> HelloWorld_2 </a>
</body>
</html>
HelloAction.java文件内容:
public class HelloAction extends Action {
public ActionForward execute(ActionMapping map, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
String para = (String)request.getParameter( "place ");
if(para.equals( "1 "))
return (map.findForward( "Hello_1 "));
else
return (map.findForward( "Hello_2 "));
}
}
web.xml文件内容:
<web-app>
<display-name> HelloApp Struts Application </display-name>
<servlet>
<servlet-name> action </servlet-name>
<servlet-class> org.apache.Struts.action.ActionServlet </servlet-class>
<init-param>
<param-name> config </param-name>
<param-value> /WEB-INF/struts-config.xml </param-value>
</init-param>
<load-on-startup> 2 </load-on-startup>
</servlet>
<servlet>
<servlet-name> action_tmp </servlet-name>
<servlet-class> org.apache.struts.action.ActionServlet </servlet-class>
<init-param>
<param-name> config </param-name>
<param-value> /WEB-INF/struts-config.xml </param-value>
</init-param>
<init-param>
<param-name> debug </param-name>
<param-value> 3 </param-value>
</init-param>
<init-param>
<param-name> detail </param-name>
<param-value> 3 </param-value>
</init-param>
<load-on-startup> 0 </load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name> action </servlet-name>
<url-pattern> *.do </url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file> hello.jsp </welcome-file>
</welcome-file-lis