我做的一个登陆页面,如果用户名、密码和验证码都输入正确,就跳转到一个页面,如果输入错误,就跳回到登录页面。
登录页面的代码如下,是一个表单:
<div class="login">
<s:form action="login/login.action"  >
     <div >
<input type="text" value="" name="userName" />
<input type="password" value="" name="password" c />
<input type="text" value="" name="rand"/>
<img src="login/rand.action" onclick="changeValidateCode(this)" title="点击图片刷新验证码"/><br>  
<input type="submit"  value=""  /> 
<input type="reset"  value=""  />
</div>
     </s:form>
</div>
login/login.action是登陆的代码,login/rand.action是验证码的代码,这些功能都是正常的。
 struts配置如下:
<action name="login" class="user.action.LoginAction" method="login">
  <result  name="success" >/buffer.html</result>
  <result  name="error" >/index.jsp</result>
</action>登录失败时action返回error,跳不到index.jsp页面。(登录成功时action返回success,可以正常跳到buffer.html。)
地址栏这时是http://localhost:10000/struts/login/login.action;jsessionid=2D3EB604D0EA3981260E136323E7AB9E,很奇怪,怎么把表单的login/login.action写到地址栏中了。望高手帮忙

解决方案 »

  1.   

    你的login。action返回什么?
    <result name="success" >/buffer.html</result>
    这个html又是干什么的?
      

  2.   

    我建议你 <s:form action="login/login.action" > 写成<s:form action="login" namespace="/login" method="post">
      

  3.   


    <action name="login" class="user.action.LoginAction" method="login">
    <result name="success" >/buffer.html</result>
    <result name="error" >/index.jsp</result>
    </action>
    你XXXXaction.java 里 什么时候return error? 逻辑多了吗
      

  4.   

    不行的话,  你直接在Action里面跳转就可以了。
      

  5.   

    我建议你 <s:form action="login/login.action" > 
    写成<s:form action="/login" namespace="login" method="post">
      

  6.   

    <result name="input" >/login.jsp</result>
    如果错误 就return “input”就可以了啊