Announcement Announcement Module
Collapse
No announcement yet.
Tiles problems with JSP c:forEach tag Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tiles problems with JSP c:forEach tag

    I have a similar problem, but one level more, imagine that you have a backing bean and what i want to loop is something like managedBean.listElements but this is passed to a jsp like a parameter 'path' so as a String I have tried in 2 ways:

    Code:
    		<definition name="initTableRD" extends="tableDefinition">
    	            <put-attribute name="xpathListObject" type="string" value="taxesFee.ruleDescriptions.ruleDescription"></put-attribute>
    	            <put-attribute name="rootXpath" value="ruleDescriptions.ruleDescription"></put-attribute>
    				<put-list-attribute name="columns" inherit="true">
    					<add-attribute value="Value" />
    					<add-attribute value="ID" />
    					<add-attribute value="Language" />
    				</put-list-attribute>
    				<put-list-attribute name="xpathElements" inherit="true">
    					<add-attribute type="string" value="value" />
    					<add-attribute type="string" value="ID" />
    					<add-attribute type="string" value="language" />       						
    				</put-list-attribute>
    		</definition>


    Code:
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
    <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>		
    		
    		<div id="itemsTable">
    			<tiles:useAttribute name="xpathListObject" id="xpathListObject" />
    			<tiles:useAttribute name="rootXpath" id="rootXpath" />
    			<tiles:useAttribute name="columns" id="columns" classname="java.util.List"/>
    			<tiles:useAttribute name="xpathElements" id="xpathElements" classname="java.util.List"/>
    			
    			
    			<table border="1">
    				<tr>
    					<c:forEach items="${columns}" var="column">
    						<th>
    							<tiles:insertAttribute value="${column}" flush="true" />
    						</th>
    					</c:forEach>
    				</tr>		
    
    							
    				<c:forEach items="${xpathListObject}" var="ruleDes" varStatus="tStatus">
    					<tr>
    						<c:forEach items="${xpathElements}" var="xpath" >
    								<td><form:input id="element-${xpath}" path="${rootXpath}[${tStatus.index}].${xpath}"  /></td>
    						</c:forEach>
    					</tr>
    				</c:forEach>
    
    				
    								
    			</table>
    		</div>

    1)xpathListObject="managedBean.listElements"

    2)xpathListObject="${managedBean.listElements}"
    Code:
    <c:forEach items="${xpathListObject}">
    is looping only on the first element....

    so it means that the variable is not interpratates as a list of objects...some solutions???

  • #2
    Same problem here...

    Comment

    Working...
    X