我不认为您真的要在这里标记文件。那太过分了,对于您想要完成的事情来说太混乱了。您需要花费一些时间来理解“范围”。除了标记文件,我将:
1)通过更改此行,将属性更改为“请求”范围而不是默认的“页面”范围:
<c:forEach items="${attributeDTOList}" var="attribute" varStatus="status">对此
<c:forEach items="${attributeDTOList}" var="attribute" varStatus="status"> <c:set var="attribute" value="${attribute}" scope="request"/>这将使“属性”成为“
requestScope”变量,该变量可在c:imported的其他JSP文件中使用。(注意:forEach不支持scope属性,因此请使用c:set在每次迭代内对其进行范围设置。)
2)将原始的jsp:include更改为c:import。因此,将其更改为:
<jsp:include page="attributeSubFeatureRemove.jsp" > <jsp:param name="attribute" value="${attribute}" /></jsp:include>对此
<c:import url="attributeSubFeatureRemove.jsp"/>
请注意,我们没有明确尝试将属性作为参数传递,因为我们已经将其提供给“ requestScope”中所有c:imported页面。
3)通过更改以下内容,修改c:imported JSP以使用requestScope引用属性:
<c:set value="${param.attribute}" var="attribute" /><c:forEach items="${attribute.subFeatures}" var="subAttribute">对此
<c:forEach items="${requestScope.attribute.subFeatures}" var="subAttribute">在这里,我们不再需要c:set,因为您已经有了可用的属性。我们只需要确保在该变量的requestScope中查找,而不是在默认的pageScope中或作为参数查找(因为不再将其作为参数传递)。
This technique will be a lot easier for you to manage.



