This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
i am working in struts 2.0, just started today. I have one class which contains 8 attributes. I have to add different objects of that class in a list. I have to populate that list in a jsp page. Means getting those list and iterating through list , i have to get those different attributes of objects. i have to present all the attributes of one object in a single row. And for different object in different rows. For this in struts 1.2 , i have to add that list in session , and in jsp page , using logic:iterate i can do. But i don't know know how to do in struts 2.0 Please help , i have to do this immediately..
Discussion of Java, Struts, Spring, Hibernate, etc. <a href="http://www.wantii.com" target="_blank" rel="nofollow">www.wantii.com</a>
Joined: Apr 05, 2006
hey wes your link is not working properly. Actually my requirement is: i have one java bean, in that bean i have 8 properties. In runtime i will get number of objects for that bean from database. i have to populate all the fields in a table like one object in one row and one proeprty in one column.
take an example of emp table, i have a java bean of emp with those attributes. i want to populate those different employees. like that table
thanks in advance ratna sekhar
Joined: Jul 07, 2007
Darnit, I wonder what I did wrong... Oh well, basically, it works like this. Your collection of objects has to implement the java.util.List interface (such as a Vector). Then, you can place a public Vector<Emp> getEmp() method in your Action. Then when you use the s:iterator tag, you tell it that you want to iterate over "emp." The tag will place one of your objects on the value stack for each iteration, which will make the attributes of your Emp class available to s:property.
Here is the code from my example -
In my example, I have a method in my action that looks like this -
The getMessages method makes the Vector available on the value stack, the s:iterator tag finds that method when I say value="messages."
-Merrill Cleaned up the smileys [ July 09, 2007: Message edited by: Merrill Higginson ]
Joined: Jul 07, 2007
cripe! those smileys made that post hard to read... the article is available here -
In the future, if you want to get rid of those annoying smileys, go back to your post and click the edit button (The pencil and paper icon). Then scroll down to the options section of the page and check the checkbox labeled "Disable smilies in this post". [ July 09, 2007: Message edited by: Merrill Higginson ]