日期:2014-05-18  浏览次数:20649 次

struts页面跳转问题
struts-config.xml
<?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= "loginForm "   type= "chojo.struts.form.LoginForm "   />  
    </form-beans>  
    <global-exceptions   />
    <global-forwards   >
<forword   name= "ToErrorPage "   path= "/common/messagepage.jsp "/>
    </global-forwards   >
    <action-mappings>  
<action   path= "/login "  
type= "chojo.struts.action.LoginAction "
name= "loginForm "  
scope= "request "  
validate= "true "
input= "/index.jsp ">  
<forword   name= "ToUserPage "   path= "/admin/userinfo.jsp "/>
</action>
    </action-mappings>  
    <message-resources   parameter= "chojo.ApplicationResources_zh "   />
</struts-config>  

index.jsp

<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.0   Transitional//EN ">
<head> <title> chojoinfosystem </title> </head>
<%@   include   file= "/common/taglibs.jsp "%> <head>

<html:html>
<META   http-equiv=Content-Type   content= "text/html;   charset=shift_jis "> </HEAD>
<body>
<html:form     action   =   "login.do "   focus   =   "adminid "   method   =   "post ">
<table   align= "center ">
<tr> <td> username </td> <td> <html:text   property= "adminid "   size= "10 "/> </td> </tr>
<tr> <td> password </td> <td> <html:password   property= "password "   size= "11 "/> </td> </tr>
</table>
    <table   align= "center "   valign= "top "   height= "40 "   cellspacing= "0 "   cellpadding= "0 "   border= "0 ">
<tr>
<td> <html:submit   property= "submit "> login </html:submit> </td>
<td> <html:reset> reset </html:reset> </td>
</tr>
    </table>
</html:form>
</body>
</html:html>

LoginAction.java

public   class   LoginAction   extends   Action   {
public   ActionForward   execute(ActionMapping   mapping,   ActionForm   actionForm,  
HttpServletRequest   request,   HttpServletResponse   response)   throws   Exception   {  
String   PageForward   =   "ToErrorPage ";
Ht