我做的一个登陆页面,如果用户名、密码和验证码都输入正确,就跳转到一个页面,如果输入错误,就跳回到登录页面。
登录页面的代码如下,是一个表单:
<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写到地址栏中了。望高手帮忙
登录页面的代码如下,是一个表单:
<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写到地址栏中了。望高手帮忙
解决方案 »
- 请教关于spring声明事务的问题,望高手赐教!!!!!
- tomcat与配置DNS 的问题
- 第二次请教概念问题java vs C#
- JAVA/vc++工程师工作好机会
- 在struts中,该如何遍历这样的Bean???
- 只知道一个节点的名称,不知道它是哪个节点的字节点,如何获的该节点的值?
- 数据库连接:[SQLServer 2000 Driver for JDBC]Error establishing socket.
- 照着官方网站下载的struts文档学着做出现问题,希望大家帮忙!
- 不用servlet如何处理请求呢。
- 上传超过2M的图片时,浏览器报连接被重置的错误信息
- 问问大家网页布局侧重用table好,还是侧重用div好
- 求救(急):java poi导出word 如何设置word模式为页面视图
<result name="success" >/buffer.html</result>
这个html又是干什么的?
<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? 逻辑多了吗
写成<s:form action="/login" namespace="login" method="post">
如果错误 就return “input”就可以了啊