aspose file tools*
The moose likes Struts and the fly likes Struts +retriving data. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts +retriving data." Watch "Struts +retriving data." New topic
Author

Struts +retriving data.

A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
Hi all, I am going to ask in here as I have had nothing but good experiences in this forum.
The first question is how does one go about pulling a undetermined number of values out of a jsp page. I am printing off an array that could have between 0 and 20 values, and I would like to know how to pull values from them. There will be two values that I need to pull but I haven't found a way to pull them in a loop without haivng to declare 20 different methods. Any suggestions to what techniques would make this the easiest would be fantastic.

2) I am trying to pull data from a java object inside of a jsp page. I am not certain where I am going wrong. What I am doing is putting object 1 in session. Inside of object 1 is an array of object 2 and inside obect2 is an array of object3. I want to be able to iterate of all of the values in object 3 but it is saying that it can't find bean object1.object2.object3 in any scope. Any thoughts/suggestions owuld be greatly appreciated.

thanks in advance for your time spent reading this.
Ilja Smoli
Ranch Hand

Joined: Dec 02, 2001
Posts: 64
Hi
1. If "pulling a undetermined number of values out of a jsp page" means that you want to iterate in jsp over collection in some scope, then you can take a look at <logic:iterate> tags.
Or if this means you want to submit from jsp page "undetermined number of values" then might worth having for example java.util.List property in corresponding ActionForm and use <nested:> tags...

2. and here again <nested:> or jstl tags could help you I guess.
Christian Nash
Ranch Hand

Joined: Jan 17, 2006
Posts: 107
Hi,
Can you be more specific as to what you mean by pulling data??? Whether you want to access the data in jsp or pass those values to an ActionForm is not very clear.I haven't actually understood your questions.


- Christian
A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
Sorry I should have written more details. I am creating a form page (jsp) by iterating over an ArrayList and I want to be able to pull all of the values from the textfields in the corresponding action. I know I can do it using formname.gettextareaName but I don't know how many there will be. It could be variable between 0 and 100. The only thing that came to mind was to keep a counter of how many are created but that hardly seems elegant.

thanks for any suggestions.
A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
Originally posted by A knibbs:
Sorry I should have written more details. I am creating a form page (jsp) by iterating over an ArrayList and I want to be able to pull all of the values from the textfields in the corresponding action. I know I can do it using formname.gettextareaName but I don't know how many there will be. It could be variable between 0 and 100. The only thing that came to mind was to keep a counter of how many are created but that hardly seems elegant.

thanks for any suggestions.


The second part of the question is asking how I can get the value of element within a object that is in an ArrayList of those objects which is in an ArrayList of objects.
It goes something like I have a price for a product. I have an arraylist of those products. A group of products is put in an order and I have an arraylist of orders. That arraylist is contained within a user object. What I want to be able to do is pull out each price for a particular order, but I don't know how to use the iterator/struts to pull out a specific order and then iterate over those prices.

thanks again for any suggestions/ideas.
 
 
subject: Struts +retriving data.