我有一个jsp页面,我在其中使用logic:iterate
迭代集合,并且每个项目都显示一个html:form
。 这可以工作,但每次我提交这些表单之一并重新加载页面时,所有其余表单都会填充上次插入的值。 可能有些东西仍然在会话中,因为表单都是相同的类型,它们都被预填充。Struts - 在<逻辑:迭代>中提交<html:form>
这是我的jsp:
<%@ page language="java"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<html>
<body>
<html:img action="/viewMedia.do?method=viewImageThumb" paramId="idImage"
paramName="image" paramProperty="idImage" />
<logic:iterate name="regions" id="region">
<p>
<html:img action="/viewMedia.do?method=viewRegion" paramId="idRegion" paramName="region" paramProperty="idRegion" />
<logic:notPresent name="region" property="person">
<html:form action="/AssignRegion.do" >
<html:text property="name" />
<html:text property="surname" />
<html:checkbox property="usedForTraining" />
<html:hidden property="idRegion" name="region" />
<html:hidden property="idImage" name="region"/>
<html:submit />
<html:cancel />
</html:form>
</logic:notPresent>
<logic:present name="region" property="person">
<bean:write name="region" property="person.name"/>
<bean:write name="region" property="person.surname"/>
</logic:present>
</p>
</logic:iterate>
</body>
</html>
我怎样才能避免这种情况?