• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

using logic:iterate index with html:multibox

 
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

Can I use logic:iterate's indexId to give a index number to the all values we are using in html:multibox .

in other words, the senario is like this.



where selectedItems is declared as a String array in form bean.
As code say orderid,publication and edition comming from back end of mediaorder class.

now the problem is i want to print the selected values through checkboxes in some other jsps.

please help me.

regards,
rahul
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's one possible solution: Change the JSP so that only orderid is used as the value of the multibox, provided orderid will uniquely identify the order. When the form is submitted, you will then have a String array containing order Ids. At that point, you can query the database to get the rest of the information for each order, populate an order POJO for each, and create an ArrayList of order POJOs that can be used in other JSPs.

Yes, I know you already queried the database to get this information before, but if you've coded your model layer efficiently and are using a well-tuned database, re-getting the information from the database will be fast and will not significantly affect your response time.
 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr. Merrill Higginson,

Using String array I can print the selected values in different pages.
But after putting into string array how can we retrive them as we put them into it. in other words, if i want to print coloumns like orderid publication, edition then this string array can not solve this problems, i guess. And if we want add the data in the back end for the selectd values, then it would become very difficult to solve it.

So is there any solution for this.

regards,
rahul


Originally posted by Merrill Higginson:
Here's one possible solution: Change the JSP so that only orderid is used as the value of the multibox, provided orderid will uniquely identify the order. When the form is submitted, you will then have a String array containing order Ids. At that point, you can query the database to get the rest of the information for each order, populate an order POJO for each, and create an ArrayList of order POJOs that can be used in other JSPs.

Yes, I know you already queried the database to get this information before, but if you've coded your model layer efficiently and are using a well-tuned database, re-getting the information from the database will be fast and will not significantly affect your response time.

 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rauhl Roy:
Using String array I can print the selected values in different pages.
But after putting into string array how can we retrive them as we put them into it.


If the values are of a fixed length, you can use the String class's substring method to separate the values from a single string into multiple strings. If the values are not of a fixed length, you could put some sort of separator character between each value. Then when it's time to display the values separately, use the separator character to tell where one value ends and the other begins.

Originally posted by Rauhl Roy:
And if we want add the data in the back end for the selectd values, then it would become very difficult to solve it.


I'm not suggesting you add any data in the back end. I'm simply suggesting that you retrieve the data that's already there in the back end again, rather than trying to pass it through a composite string.

While parsing through this composite string will work, it seems really awkward and "kludgy" to me, and I wouldn't call it very good Object Oriented design.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic