aspose file tools*
The moose likes Struts and the fly likes Dynamically Allocate Array lists to options in a dropdown for struts JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dynamically Allocate Array lists to options in a dropdown for struts JSP" Watch "Dynamically Allocate Array lists to options in a dropdown for struts JSP" New topic
Author

Dynamically Allocate Array lists to options in a dropdown for struts JSP

Vertika Solanki
Greenhorn

Joined: Mar 12, 2010
Posts: 10
The situtation is ...
When user selects a value from Dropdown 1. Then depending on the value selected another dropdown should be populated from 1 of 2 diffrent Araaylist in struts form.

I'm absloutely naive at AJAX. As I donot have the values in database , i don't think AJAX will work here.

The deciding dropdpwn is



The one that needs to be set is



I tried hiding and showing them as required .



but when the form is submitted it doesn't take the value for the secCodeTypeOptions options even when it is displayed rather it picks up the first value from the secCodeTypeOptionsIntl array

please help me how can I get thru ....
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

Welcome to the Ranch.

A couple of things:

Firstly, this is an HTML forum. Please show the HTML created by the Struts tags -- not the Struts markup. That's not useful to anyone here.

Secondly, you said:
I'm absloutely naive at AJAX. As I donot have the values in database , i don't think AJAX will work here.
Huh?

What does a database have to do with Ajax?

And, where are the secondary terms coming from?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vertika Solanki
Greenhorn

Joined: Mar 12, 2010
Posts: 10



as I mentioned I am new to AJAX ...

btw...thanks that was indeed helpful !!!


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

You didn't answer my question. Where are the secondary terms coming from? Perhaps Ajax is the best way, perhaps not,. Can't help without more details.
Vertika Solanki
Greenhorn

Joined: Mar 12, 2010
Posts: 10
Bear Bibeault wrote:You didn't answer my question. Where are the secondary terms coming from? Perhaps Ajax is the best way, perhaps not,. Can't help without more details.

i don't get what you mean by "secondary terms" ...
If you meant the values in the dropdown ...they are being populated by a Utility class from Arraylists that are populated before the JSP loads.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

So they are already on the client? In a JavaScript data construct?
Vertika Solanki
Greenhorn

Joined: Mar 12, 2010
Posts: 10
Bear Bibeault wrote:So they are already on the client? In a JavaScript data construct?


yes as i mentioned in my first post the Arraylists are in the Form . I have 2 ArrayLists in my form out of which 1 has to be used to fill a dropdown when a value from the deciding dropdown is selected.

I do see the correct dropdown values on the screen after selecting a value from the deciding dropdown (tradegroup)......but on submiting the form values from only one arraylist is getting submitted.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

Vertika Solanki wrote:yes as i mentioned in my first post the Arraylists are in the Form .

That has no meaning. ArrayLists are a server-side concept, forms are client side concepts. So I have no idea what you mean by "Arraylists are in the Form".
Vertika Solanki
Greenhorn

Joined: Mar 12, 2010
Posts: 10
Bear Bibeault wrote:
Vertika Solanki wrote:yes as i mentioned in my first post the Arraylists are in the Form .

That has no meaning. ArrayLists are a server-side concept, forms are client side concepts. So I have no idea what you mean by "Arraylists are in the Form".


By for I mean the ActionForm. I can have a member of type "ArrayList" in my ActionForm ....



if you could please move this thread to the JSP / Struts forum and delete the duplicate one ....
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

Moved to Struts.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamically Allocate Array lists to options in a dropdown for struts JSP