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

开始学习Struts,遇到一个问题,请大家帮助。
刚刚开始学习Struts,遇到一个问题,index.jsp点击提交按钮的时候地址栏里显示
http://localhost:8080/mystruts/register.do;jsessionid=3FA77C83EA8BCCCECCF2B522E1A30EB8  
画面并没有任何显示信息,也就是说没有转到success.jsp或者failure.jsp,请问错误是出在什么地方?
struts-config.xml配置的 <form-beans> 和 <action-mappings> 信息如下:
//-------------------------start----------------------------------
<form-beans>
<form-bean
name= "RegisterForm "
type= "actionform.RegisterForm ">
</form-bean>
</form-beans>
<action-mappings>
<action
path= "/register "
type= "action.RegisterAction "
name= "RegisterForm "
scope= "request "
input= "/index.jsp ">
<forward
name= "success "
path= "/success.jsp "/>
<forward
name= "failure "
path= "/failure.jsp "/>
</action>
</action-mappings>
//------------------------end--------------------------------------

RegisterAction.java文件内容:
//------------------------start--------------------------------------
package   action;

import   java.io.IOException;
import   javax.servlet.http.*;
import   actionform.RegisterForm;
import   org.apache.struts.action.*;
import   javax.servlet.ServletException;

public   class   RegisterAction   extends   Action   {

public   ActionForward   excute(
ActionMapping   mapping,
ActionForm   form,
HttpServletRequest   req,
HttpServletResponse   res)   throws   IOException,   ServletException   {
 
RegisterForm   rf   =   (RegisterForm)   form;
String   username   =   rf.getUsername();
String   password   =   rf.getPassword();
String   repassword   =   rf.getRepassword();

if   (isNullOrEmpty(username))   {
return   mapping.findForward( "failure ");
}

if   (isNullOrEmpty(password))   {
return   mapping.findForward( "failure ");
}

if(isNullOrEmpty(repassword)){
return   mapping.findForward( "failure ");
}

return   mapping.findForward( "success ");
}

private   boolean   isNullOrEmpty(String   string){

return   string   ==   null   ||   string.trim().length()   ==   0;

}
}
//------------------------end---------------------------------------
RegisterForm.java文件内容:
//----------------------------start-------------------------------
package   actionform;

import   javax.servlet.http.*;
import   org.apache.struts.action.ActionForm;

public   class   RegisterForm   extends   ActionForm   {

private   String   username;
private   String   password;
private   String   repassword;

public   String   getUsername()   { <