• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts +retriving data.

 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
A knibbs
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic