1

How do I select a specific object from the action class when pulling up multiple objects in JSP.

From my action class I pass through Struts five of the same object. In JSP how would I select a specific object and property of the object to display on page. I have tried putting various values and names in the <s:form> tag but I have yet to figure out how to do it. A push in the corrected direction would be welcome.

Roman C
  • 49,761
  • 33
  • 66
  • 176
Aaron
  • 224
  • 1
  • 4
  • 13
  • I have a for loop with an if statement inside for(Walkthrough w: walkthroughs) { if(runThrough==1) { Walkthrough sectionOne = new Walkthrough(); sectionOne.set_id(w.get_id()); sectionOne.set_areaName(w.get_areaName()); sectionOne.set_walkthroughText(w.get_walkthroughText()); } and I have runThrough++ at the end – Aaron Sep 25 '12 at 19:35
  • What displayed then you have put something in the tag? Could you post your JSP? – Roman C Sep 25 '12 at 19:41
  • Nothing at all diplays but the page does not break either. – Aaron Sep 25 '12 at 19:46
  • @user1698308 Please edit the *question* with updated info; code in comments is useless. You can notify a question asker with a comment, but use an `@` tag so they're notified. – Dave Newton Sep 25 '12 at 22:20

1 Answers1

0

Use

<s:iterator value="walkthroughs" >
    <s:property value="id"/><br>
    <s:property value="areaName"/><br>
...
</s:iterator>

And you should rename your getter methods to be bean compartible.

getId(), getAreaName()
Roman C
  • 49,761
  • 33
  • 66
  • 176