• 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

indexed properties

 
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,

My application has a class called BankAccount and it has four fields called
bankId, bankName, accountHolder, country.

And I am retriving the list of bank data through <logic: iterate> and I want to display a radio button along with every row I retrived. I am able to do that by using <html:radio>,but i want to know how to get values of four fields mentioned above if user selects a radio button from the list.

(And how to display user selected values in other pages)
pls give me a simple example/code.

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
My suggestion would be to tie the radio button to the Bank ID. Assuming that this is a field that uniquely identifies each bank, once the form is submitted, you can use the Bank ID to get the rest of the information about the bank from the database and then present a page that updates this information. Example:

Assume you have List named "banks" in request scope that has a list of JavaBeans that represent a bank. You also have an ActionForm bean with a selectedBank property.

Once the form is submitted, the selectedBank property will have the BankId of the bank selected by the user. You can then get the rest from the database.
 
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
hi,

I am not using oracle as back end, so i can not call based on the bank key selected. please tell me if there is any other way to solve this problem?
 
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
The solution I showed above is not dependent on having an Oracle back end. It will work with any database.

If there is no database at all in the application (how can you have a real application without a database? Is this just a "toy" application?), then you must be keeping this information in memory somewhere. In That case I'd suggest creating a Hashmap with the Bank ID as key and a Bank object with all the other information as the value. Store the Hashmap in Application scope, and then just look up the bank by its Id when a user selects a Bank ID from the page with the radio buttons.
 
reply
    Bookmark Topic Watch Topic
  • New Topic