You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by juraj Lenharcik <ju...@datainput.de> on 2001/09/10 19:31:46 UTC

How to iterate without trouble

Cause of the lots of Questions about the ITERATE Tag, here is a simple
example how to iterate over a Hastable (using the Interface
java.util.Map.Entry):

Juraj & Michael from Germany
Struts Oldbiez (over 1.5 month of experience)   ;-)


Action:
--------

		Hashtable values = new Hashtable();		
		
		HttpSession session = request.getSession();
	   	session.setAttribute("content", values);	
	 	
		String successMessage = "werte ok";
		request.setAttribute("successMessage", successMessage);

		request.setAttribute("data", theForm);
		
View (Jsp):
-----------
		
	<logic:present name="successMessage">
		<center><h2> <bean:message
key="filter.success"/></h2></center><br>
		     <logic:iterate id="content" name="content"
type="java.util.Map.Entry" scope=session>
		     		<bean:write name="content" property="key" />
- <bean:write name="content" property="value" />
		     </logic:iterate>
	</logic:present>