有如下格式的from表單,
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:head theme="ajax"/>
<div di="view">
<s:form action="formAction" method="post" theme="simple">
<s:textfield id="name"/>
<s:submit theme="ajax" targets="view"/>
</s:form>
<div>
我想要的結果是在submit以後可以看到我輸入的姓;可如果這樣提交在action中總是取到的name值為null,
但是很奇怪,如果把上邊代改爲下面這樣又可以取得name,
<div di="view"><div>
<s:form action="formAction" method="post" theme="simple">
<s:textfield id="name"/>
<s:submit theme="ajax" targets="view"/>
</s:form>
但是我想讓submit以後這個表單頁消失,怎麽做才好呢。
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:head theme="ajax"/>
<div di="view">
<s:form action="formAction" method="post" theme="simple">
<s:textfield id="name"/>
<s:submit theme="ajax" targets="view"/>
</s:form>
<div>
我想要的結果是在submit以後可以看到我輸入的姓;可如果這樣提交在action中總是取到的name值為null,
但是很奇怪,如果把上邊代改爲下面這樣又可以取得name,
<div di="view"><div>
<s:form action="formAction" method="post" theme="simple">
<s:textfield id="name"/>
<s:submit theme="ajax" targets="view"/>
</s:form>
但是我想讓submit以後這個表單頁消失,怎麽做才好呢。
本文探讨了在使用Struts2框架时遇到的一个问题:通过Ajax方式提交表单后无法获取到表单数据的情况。作者尝试了两种不同的HTML结构,并发现只有特定结构才能使表单数据正确传递。





