File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes indexed properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "indexed properties" Watch "indexed properties" New topic
Author

indexed properties

Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401

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
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401

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

Joined: Feb 15, 2005
Posts: 4864
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: indexed properties