第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

提示不能為空的功能實(shí)現(xiàn)不了?

http://img1.sycdn.imooc.com//578f8adf0001cce407490191.jpg

不填寫內(nèi)容,直接提交,出現(xiàn)下面的錯(cuò)誤提示:

警告: Could not find action or result

No result defined for action loginDemo.loginAction and result input

at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:375)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)

at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)

at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)

at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)

.....




login.jsp部分代碼

%@?page?language="java"?import="java.util.*"?contentType="text/html;?charset=utf-8"%>
<%@?taglib?prefix="s"?uri="/struts-tags"%>
......

??<body>
???	<form?action="loginAction.action"?method="post">
???	用戶名:?<input?type="text"?name="username"><s:fielderror?name="username"></s:fielderror>
???	密碼:???<input?type="password"?name="password">
???	書籍1:???<input?type="text"?name="bookList[0].username">
???	書籍2:???<input?type="text"?name="bookList[1].username">
???	
???		?<input?type="submit"?value="提交"/>
???	</form>
??</body>


web.xml部分代碼

??<filter>
????<filter-name>struts2</filter-name>
????<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
??</filter>
??<filter-mapping>
????<filter-name>struts2</filter-name>
????<url-pattern>/*</url-pattern>
??</filter-mapping>

loginAction 部分代碼

	public?void?validate()?{
		if(user.getUsername()?==?null
				||"".equals(user.getUsername())){
			this.addFieldError("username","用戶名不能為空");
		}
	}


正在回答

4 回答

<action?name="loginAction"?method="login"?class="loginDemo.loginAction">

????????????<result name="input">/success.jsp?</result>

????????</action>


1 回復(fù) 有任何疑惑可以回復(fù)我~
#1

LebronJames_ 提問(wèn)者

非常感謝!
2016-07-31 回復(fù) 有任何疑惑可以回復(fù)我~

樓上正解,result的name默認(rèn)類型是success。

0 回復(fù) 有任何疑惑可以回復(fù)我~

struts.xml

<?xml?version="1.0"?encoding="UTF-8"?>
<!DOCTYPE?struts?PUBLIC

	"-//Apache?Software?Foundation//DTD?Struts?Configuration?2.1//EN"

	"http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
	<package?name="default"?namespace="/"?extends="struts-default">
		<action?name="loginAction"?method="login"?class="loginDemo.loginAction">
			<result?>/success.jsp?</result>
		</action>
	</package>

</struts>


0 回復(fù) 有任何疑惑可以回復(fù)我~

action和result的xml貼出來(lái)看看

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

LebronJames_ 提問(wèn)者

上面貼了啊
2016-07-20 回復(fù) 有任何疑惑可以回復(fù)我~
#2

LebronJames_ 提問(wèn)者

輸入用戶名后,會(huì)正常跳轉(zhuǎn)。 如不輸入用戶名,會(huì)出現(xiàn)上面的警告。
2016-07-20 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

提示不能為空的功能實(shí)現(xiàn)不了?

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)