struts.xml
<action name="loginAction" class="loginAction" method="doLogin">
<result name="l_success">/index.jsp</result>
<result name="l_faile">/login.jsp</result>
<result name="input">/login.jsp</result>
</action>login.jsp<div align="center" style="margin-top:200px">
<s:fielderror/>
<form action="loginAction.action" method="Post">
<table height="100" border="3">
<tr>
<td>用户名:</td>
<td><input type="text" name="userName"></td>
</tr>
<tr>
<td>密 码:</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="登录"> <input type="button" value="注册"/></td>
</tr>
</table>
</form>
</div>
LoginActionpublic String doLogin() {
return "l_success";
}public void validateDoLogin() {
if (userName == null || userName.equals("")) {
addFieldError("user.userName","请输入用户名!");}
if (password == null || password.equals("")) {
addFieldError("user.userPassword","请输入密码!");}
if (userName.length() > 15 || userName.length() < 5) {
addFieldError("user.userName","用户名不能大于15或小于5个字符!");}
if (password.length() > 20|| password.length() < 5) {
addFieldError("user.userPassword","密码不能大于20或小于5个字符!");}}为什么连续点击登录总是连上一次的错误信息都从fileError中取出啊,连续点击两次,如下
* 请输入用户名!
* 用户名不能大于15或小于5个字符!
* 请输入用户名!
* 用户名不能大于15或小于5个字符!
* 请输入密码!
* 密码不能大于20或小于5个字符!
* 请输入密码!
* 密码不能大于20或小于5个字符!
<action name="loginAction" class="loginAction" method="doLogin">
<result name="l_success">/index.jsp</result>
<result name="l_faile">/login.jsp</result>
<result name="input">/login.jsp</result>
</action>login.jsp<div align="center" style="margin-top:200px">
<s:fielderror/>
<form action="loginAction.action" method="Post">
<table height="100" border="3">
<tr>
<td>用户名:</td>
<td><input type="text" name="userName"></td>
</tr>
<tr>
<td>密 码:</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="登录"> <input type="button" value="注册"/></td>
</tr>
</table>
</form>
</div>
LoginActionpublic String doLogin() {
return "l_success";
}public void validateDoLogin() {
if (userName == null || userName.equals("")) {
addFieldError("user.userName","请输入用户名!");}
if (password == null || password.equals("")) {
addFieldError("user.userPassword","请输入密码!");}
if (userName.length() > 15 || userName.length() < 5) {
addFieldError("user.userName","用户名不能大于15或小于5个字符!");}
if (password.length() > 20|| password.length() < 5) {
addFieldError("user.userPassword","密码不能大于20或小于5个字符!");}}为什么连续点击登录总是连上一次的错误信息都从fileError中取出啊,连续点击两次,如下
* 请输入用户名!
* 用户名不能大于15或小于5个字符!
* 请输入用户名!
* 用户名不能大于15或小于5个字符!
* 请输入密码!
* 密码不能大于20或小于5个字符!
* 请输入密码!
* 密码不能大于20或小于5个字符!
解决方案 »
- 求解,紧急问题,菜鸟一枚,求帮助呀,问题详细如下
- 关于hibernate的疑惑
- SSH整合出问题了。大侠帮帮忙。
- struts的版本很多,该学什么版本啊?谢谢
- java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0
- J2EE企业开发是什么,web开发又是什么,两者有什么区别
- jsp读取和保存字段问题
- 触发器怎么用?在什么情况下用?最好举个简单例子,谢谢!
- 请问一个简单问题
- 面向对象的荒诞之处
- jsp往ACCESS数据库中写不进去数据,并且还不提示错误。。。
- 关于删除操作中ID传值到action中的问题
struts.xml
<action name="loginAction" class="loginAction" method="doLogin">
<result name="success">/success.jsp</result>
<result name="input">/login.jsp</result>
</action>
<action name="loginAction" class="com.CompanyName.ProjectName.FunctionName.loginAction" method="doLogin">
<result name="success">/success.jsp</result>
<result name="input">/login.jsp</result>
</action>
struts.xml
<action name="loginAction" class="com.CompanyName.ProjectName.FunctionName.loginAction" method="execute">
<result name="success">/success.jsp</result>
<result name="input">/login.jsp</result>
</action>