说一句也许没用的,找个IDE写吧,然后弄个easy struts,真的省事很多

解决方案 »

  1.   

    你多了个return mapping.findForward("failure");
    改成下面的public class RegisterAction extends Action 
    {
    public ActionForward perform (ActionMapping mapping,
    ActionForm form,
    HttpServletRequest req,
    HttpServletResponse res) {
    // ①Cast the form to the RegisterForm
    RegisterForm rf = (RegisterForm) form;
    String username = rf.getUsername();
    String password1 = rf.getPassword1();
    String password2 = rf.getPassword2();
    // ②Apply business logic
     if (password1.equals(password2)) {
        return mapping.findForward("success");
     }else{ 
       return mapping.findForward("failure");
      }
    }}
      

  2.   

    package app;
    import java.lang.reflect.InvocationTargetException; 
    import java.util.Locale; 
    import javax.servlet.ServletException; 
    import javax.servlet.http.HttpServletRequest; 
    import javax.servlet.http.HttpSession; 
    import javax.servlet.http.HttpServletResponse; 
    import org.apache.struts.action.Action; 
    import org.apache.struts.action.ActionError; 
    import org.apache.struts.action.ActionErrors; 
    import org.apache.struts.action.ActionForm; 
    import org.apache.struts.action.ActionForward; 
    import org.apache.struts.action.ActionMapping; 
    import org.apache.struts.util.MessageResources;public class RegisterAction extends Action 
    {
    public ActionForward perform (ActionMapping mapping,
    ActionForm form,
    HttpServletRequest req,
    HttpServletResponse res) {
    // ①Cast the form to the RegisterForm
    RegisterForm rf = (RegisterForm) form;
    String username = rf.getUsername();
    String password1 = rf.getPassword1();
    String password2 = rf.getPassword2();
    // ②Apply business logic
    if (password1.equals(password2)) {return mapping.findForward("success");
    }
    else{ 
    return mapping.findForward("failure");
    }
    }
    // ④Return ActionForward for failure
    //return mapping.findForward("failure"); 此句多了 删除就好了。这调过了
    }
      

  3.   

    还有你的 RegisterForm 类最好引一下
      

  4.   

    if else都有return了
    所以最后一个return永远不可能达到....
      

  5.   

    用Eclipse+Eclipse-plusin配合比较好看你的问题
      

  6.   

    版本太老了,还是perform方法,要更新换代啊!
      

  7.   

    : jianghuxing(回头看看原来我一无所有)  
    这个程序你调过了么 能告诉我你的机器的配置么
    最好能详细一点  比如环境变量什么的
    还有就是编译过程  
    比如在命令行下输入什么命令阿现在我肯定不是程序的问题而是 我的编译方法问题
    以为 一个例子程序 应该是没问题的  我在编译的时候也出现同样的问题
    cannot resolvr symbol
    symbol package app
    Import app.RegisterForm
    cannot resolvr symbol
    symmbol rf =<REgisterForm> form// 我把Import app.RegisterForm;填进了我的程序中//如果不填那句
    错误就是
    cannot resolvr symbol
    symmbol rf =<REgisterForm> form
    谢谢阿