你的struts.config 里面关于这个action的配置

解决方案 »

  1.   

    struts.config  如下<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
              "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"><struts-config>
      <form-beans>
        <form-bean name="actionForm" type="jbstruts.myActionForm" />
      </form-beans>
      <action-mappings>
        <action name="actionForm" type="jbstruts.UserLoginAction" validate="true" input="/userLogin.jsp" scope="request" path="/UserLoginAction">
          <forward name="loginSuccess" path="/bosom.jsp" />
          <forward name="loginFailure" path="/failure.jsp" />
        </action>
        <action name="actionForm" type="jbstruts.IndexAction" validate="true" input="/bosom.jsp" scope="request" path="/indexAction">
          <forward name="success" path="/display.jsp" />
          <forward name="failure" path="/failure.jsp" />
        </action>
      </action-mappings>
    </struts-config>
      

  2.   

      if (userName.equals("abc")&&password.equals("123")) //识别用户的身份 
          {             //这一句把用户名传给下一页 
                userLoginForm.setLastName(userName); 
                userLoginForm.setPassword(password); 
                System.out.println("11111111111111");
                return (actionMapping.findForward("loginSuccess")); 
            } 
          else 
          { 
               System.out.println("22222222222");          return (actionMapping.findForward("loginFailure")); 
          } 加上两行调试信息 看看跳到哪里
      

  3.   


    LZ的UserLoginAction是从Action继承出来的,Action默认执行的方法是execute方法,所以perform没有被执行。可以从DispatchAction继承,然后在form中指定执行perform方法。<action name="actionForm" type="jbstruts.UserLoginAction" validate="true" input="/userLogin.jsp" scope="request" path="/UserLoginAction" parameter="method"> 
    <html:hidden property="method" value="perform"/>
      

  4.   

    不好意思 你有三个return  在这个return前面加个调试信息看看信息
            return new ActionForward(actionMapping.getInput()); // 返回到初始
      

  5.   

    6楼的 我照你说的做了  在struts.config 里加入了parameter="method"
     在form里加入了<html:hidden property="method" value="perform"/>
    重启了下Tomcat  可是还是不行   浏览器还是空白 
    地址栏显示如下 
    http://127.0.0.1:8080/strutsdemo/UserLoginAction.do;jsessionid=6AFA5E8B42D157A42E75CFF67C5FAC54我再试试7楼的 
      

  6.   

    7楼的也试验了  3个return前面都加了输出  可是控制台还是没有输出感觉6楼的说的有道理  也许这个方法真就没执行。可是怎么办呢
      

  7.   

    直接改成execute方法试试,六楼的正解
      

  8.   

    那就是吧perform 改成execute 就可以了
      

  9.   

    你要重写action,引用dispatchaction才有用的....
    你extends action就只能用execute,他默认的
    只有你extends despathchaction指定parameter才可以用别的名称作为方法名的...
      

  10.   

    楼主的头像 看了让人 不舒服! 超级不喜欢他(t-bag)
      

  11.   

    你看看他的在越狱中的表现  相信你对他不会反感了  1.T-BAG 从第一季出场,由变态、恋童、双性恋、SM这些身份而观众竟然能喜欢他。 2.T-BAG 在越狱集团中身处孤境,无队友支持帮助,仍然成功出逃。 3.T-BAG 的断手续借,这是医学界、兽医界的一大盛世。 4.T-BAG 能从各有特长、智慧、聪明、狡猾的越狱集团手中,暗渡陈仓拿到五百万。 5.T-BAG 能强奸众多幼童,不被判处死刑,在狱中还活的飒飒脱脱。 6.T-BAG 开创21世纪同志界裤兜外翻新潮流。 7.T-BAG 与英文T-BACK 发音一致,意思近似。 T-bag: How about getting us to somewhere cooler, say, Africa? 
    把我们丢到凉快点的地方去怎么样,比如,非洲? 
       hey, this man was still white this morning! 
      嘿,早上这哥们还是个白人呢! 
     在Fox River的每一天,他都希望Susan在洗完碗筷后能轻轻展开他的信,默默地读:“There was a candle in the window, just waitin' for me to walk up them front steps. When I wake up from nightmare, I feel I still love you, Susan.”    T-bag: You think you are the only one who feels betrayed? I…lovedyou, Susan. Real love. For the first time in my life... And then…andthen what you do to me like that just throw me back into the dark andtoss me out of the back door...I have sins in the past. But when I metyou, the person, that one who did all the terrible things, he died. AndI was reborn. By the grace of your love I was a new man, a better man.When you sent me here to this place with these people, you bring thatdirty bastard right home. 
       你认为只有你觉得被人背叛了吗?我曾经爱过你,Susan.我生命中的第一次真爱。而你。。而你所做的,却是把我扫地出门,重新赶回黑暗之中。我过去是有过罪恶,但当我遇见你的那一刻,那个做尽坏事的人就已经死了,而我则获得了重生。在你爱情的光辉中,我成了一个新的人,一个更好的人。当你把我送进这里,与这些人为伍时,过去那个肮脏的罪人又将复活。 
    天堂与地狱的一线之隔,原来是爱。
      

  12.   

    问题解决了  确实是只要把方法改成execute就可以了  真是学到知识了分都给6楼了  11,12,14楼就委屈点了  以后发贴的时候尽量厚道一点