RE: RE: How can I get a value from a Javascript for a formbean?

2002-10-03 Thread Galbreath, Mark

That's automatically done for you by Struts through your action mappings in
struts-config.xml. In your case, since you have a multi-select listbox, it
would be passed as an array.  If you named your listbox "choices" with the
"multiple" attribute, when the user presses  Struts will modify the
state of your corresponding variable in your ActionForm subclass if you have
the appropriate JavaBean methods:

private String[] choices = null;

public void setChoices( String[] choices) {
  this.choices = choices;
}

public String[] getChoices() {
  return choices;
}

Then you can use your Action class to do whatever you need with the array
element's values:

MyActionForm myForm = (MyActionForm) form;
String[] values = myForm.getChoices();
// do something with the values
for(int i = 0; i < values.length; i++) {
  System.out.println( values[ i ]); 
}

Mark
-Original Message-
From: Vernon Wu [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 6:05 PM
To: Struts Users Mailing List
Subject: Re: RE: How can I get a value from a Javascript for a formbean?


Hi, Mark,

Thanks for sharing your code.

I haven't use Javascript a lot and am sort of figuring out how the
JavaScript code works: the data will be stored in the 
formbean after the submit button is clicked. It will great appreciated if
you can elabourate how it works with a formbean.

Regards,

Vernon

10/3/2002 5:42:19 AM, "Galbreath, Mark" <[EMAIL PROTECTED]> wrote:

>Use the attached JavaScript file for your codebase and call the appropriate
>function based on the user's action (onChange(), delete, submite, etc.).
>It's self-evident what values need to be passed.
>
>Mark
>
>-Original Message-
>From: Vernon Wu [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, October 02, 2002 9:42 PM
>To: [EMAIL PROTECTED]
>Subject: How can I get a value from a Javascript for a formbean?
>
>
>I have two selected lists in a form. The data in the second list will
change
>accordingly when the selected item in the first 
>list is changed. My question is how to get the second selected item for the
>formbean. I use a framworks similar with 
>Struts. Here is the code segment:
>
>  
> value="-1">-1
> value="0">0
> value="1">1
> value="2">2
>  
>  
>    
>  
>
>
>
>function SetField02(){
>   //...   
>   return ;
>}
>
>
>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>




--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: RE: How can I get a value from a Javascript for a formbean?

2002-10-03 Thread Vernon Wu

Hi, Mark,

Thanks for sharing your code.

I haven't use Javascript a lot and am sort of figuring out how the JavaScript code 
works: the data will be stored in the 
formbean after the submit button is clicked. It will great appreciated if you can 
elabourate how it works with a formbean.

Regards,

Vernon

10/3/2002 5:42:19 AM, "Galbreath, Mark" <[EMAIL PROTECTED]> wrote:

>Use the attached JavaScript file for your codebase and call the appropriate
>function based on the user's action (onChange(), delete, submite, etc.).
>It's self-evident what values need to be passed.
>
>Mark
>
>-Original Message-
>From: Vernon Wu [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, October 02, 2002 9:42 PM
>To: [EMAIL PROTECTED]
>Subject: How can I get a value from a Javascript for a formbean?
>
>
>I have two selected lists in a form. The data in the second list will change
>accordingly when the selected item in the first 
>list is changed. My question is how to get the second selected item for the
>formbean. I use a framworks similar with 
>Struts. Here is the code segment:
>
>  
> value="-1">-1
> value="0">0
> value="1">1
> value="2">2
>  
>  
>    
>  
>
>
>
>function SetField02(){
>   //...   
>   return ;
>}
>
>
>
>
>
>--
>To unsubscribe, e-mail:
>
>For additional commands, e-mail:
>
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: How can I get a value from a Javascript for a formbean?

2002-10-03 Thread Galbreath, Mark

Use the attached JavaScript file for your codebase and call the appropriate
function based on the user's action (onChange(), delete, submite, etc.).
It's self-evident what values need to be passed.

Mark

-Original Message-
From: Vernon Wu [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 02, 2002 9:42 PM
To: [EMAIL PROTECTED]
Subject: How can I get a value from a Javascript for a formbean?


I have two selected lists in a form. The data in the second list will change
accordingly when the selected item in the first 
list is changed. My question is how to get the second selected item for the
formbean. I use a framworks similar with 
Struts. Here is the code segment:

  
 value="-1">-1
 value="0">0
 value="1">1
 value="2">2
  
  
 
  



function SetField02(){
//...   
return ;
}





--
To unsubscribe, e-mail:

For additional commands, e-mail:





selectlist.js
Description: Binary data

--
To unsubscribe, e-mail:   
For additional commands, e-mail: