1 Replies - 193 Views - Last Post: 25 September 2012 - 01:32 PM Rate Topic: -----

#1 acfreakman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 03-August 12

Need to select specific object in web layer

Posted 25 September 2012 - 11:48 AM

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Fire Cavern</title>
	</head>
	<body>
		<center>
			<h2>Final Fantasy VIII</h2>
			<h3>Walkthrough</h3>
			<h4>Fire Cavern</h4>
		</center>
		<s:form action="WalkthroughAction">
			<!-- This is where I had the iterator -->
		</s:form>
	</body>
</html>


originally I had an iterator where I commented on it. I am pulling five of the same object up from the action page I am wondering how to call them individually so I can do different styles for each object.

Here is my action page method call for this page.

	public String readWalkthroughByArea()
	{
		int runThrough = 1;
		walkthroughs = new Manager().readWalkthroughByArea(valueButton);
		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());
			}
			else if(runThrough==2)
			{
				Walkthrough sectionTwo = new Walkthrough();
				sectionTwo.set_id(w.get_id());
				sectionTwo.set_areaName(w.get_areaName());
				sectionTwo.set_walkthroughText(w.get_walkthroughText());
			}
			else if(runThrough == 3)
			{
				Walkthrough sectionThree = new Walkthrough();
				sectionThree.set_id(w.get_id());
				sectionThree.set_areaName(w.get_areaName());
				sectionThree.set_walkthroughText(w.get_walkthroughText());
			}
			else if(runThrough == 4)
			{
				Walkthrough sectionFour = new Walkthrough();
				sectionFour.set_id(w.get_id());
				sectionFour.set_areaName(w.get_areaName());
				sectionFour.set_walkthroughText(w.get_walkthroughText());
			}
			else if(runThrough == 5)
			{
				Walkthrough sectionFive = new Walkthrough();
				sectionFive.set_id(w.get_id());
				sectionFive.set_areaName(w.get_areaName());
				sectionFive.set_walkthroughText(w.get_walkthroughText());
			}
			runThrough++;
		}
		return valueButton;
	}



Is This A Good Question/Topic? 0
  • +

Replies To: Need to select specific object in web layer

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8346
  • View blog
  • Posts: 31,908
  • Joined: 06-March 08

Re: Need to select specific object in web layer

Posted 25 September 2012 - 01:32 PM

Don't really understand what you try to do but:
- a lot of repitition here, a chance you do not have 1000 runThroug level
- repeated operations like w.get_id() w.get_areaName() w.get_walkthroughText() why aren't they outside the if() or even the loop
- as the Walkthrough are created inside the if() and disappear after what is their use ?
- why don't you simply for() loop on the runThrough rather than adding to the end of a loop ? Why putting the whole code in a loop, just put them one after the other if you are to retype de code anyhow
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1