You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kakoli Sen (kasen)" <ka...@cisco.com> on 2012/10/28 18:33:41 UTC

Basic Struts doubt

Hello all,
    I am a newbie in Struts and JSP.
My initial JSP page is coming out where I have among other widgets, 2 combo boxes. The user selects from the first combo and then the second combo needs to be populated from db based on the value selected.
                How do I call executeAction method of Action class when the first combo box value is changed?
Attaching my Struts-config.

My JSP code snippet is thus :
<tr>
<td><label for="track_name">Track Name</label></td>
                <td><input type="hidden" value="myAction" /></td>
                <td><html:select name="TrackBaselineConfigActionForm"
                                                property="selTrackName" onchange="this.form.myAction.value='getOsVersionAction';
                                                                                                this.form.submit();">
                <option value="">Select...</option>
                <html:optionsCollection  property="trackList" label="selLabel" value="selLabel" />
                </html:select></td>
</tr>
<tr>
                <td><label for="os_version">OS Versions</label></td>
                <td><html:select name="TrackBaselineConfigActionForm"
                                                                                                property="osVersion">
                <option value="">ALL</option>
                <option value="">Standard Recommended Version</option>
                <!-- html:options name="TrackBaselineConfigActionForm" property="osVersions" /-->
                </html:select></td>
</tr>

Thanks in Advance,
Kakoli

RE: Basic Struts doubt

Posted by Martin Gainty <mg...@hotmail.com>.
Miguel

i have no problem with JQuery plugin from Johannes..i have a full implementation running here without any problems

Nota Bene:
I needed to pass in request and session parameters to the gridModel which I accomplished with some minor mods to PrepareAndExecuteInterceptor doFilter method


                
                
                   
					
					
					
					estamos en contactoMartin Gainty 
______________________________________________ 
Porfavor..no altere o interrumpta esta communicacion..Gracias


> Date: Tue, 30 Oct 2012 13:39:23 -0600
> Subject: Re: Basic Struts doubt
> From: ken.mcwilliams@gmail.com
> To: user@struts.apache.org
> 
> If using JSON this it a touch easier: http://api.jquery.com/jQuery.getJSON/
> Generally best to avoid the jquery plugin, best to use jquery (and JS
> in general) as you would normally.
> 
> 
> On Mon, Oct 29, 2012 at 2:47 AM, Juan Jose Fuentes Esteban
> <ju...@grupoica.com> wrote:
> > I suppose you want to do that asyncronously, because if not, you just have
> > to send the form and inspect the POST parameters for one with name '
> > TrackBaselineConfigActionForm' .
> >
> > So, use javascript as Lukasz recommended you. If you use jQuery, this is the
> > API function to use:
> >
> > http://api.jquery.com/jQuery.ajax/
> >
> > -----Mensaje original-----
> > De: Alejandro [mailto:aparcos@gmail.com]
> > Enviado el: domingo, 28 de octubre de 2012 23:56
> > Para: Struts Users Mailing List
> > Asunto: Re: Basic Struts doubt
> >
> > You could use the jquery ui. If you use struts2 there is a plugin for that.
> >
> > Regards :)
> >
> > 2012/10/28 Lukasz Lenart <lu...@apache.org>
> >
> >> 2012/10/28 Kakoli Sen (kasen) <ka...@cisco.com>:
> >> > Hello all,
> >> >
> >> >     I am a newbie in Struts and JSP.
> >> >
> >> > My initial JSP page is coming out where I have among other widgets, 2
> >> combo
> >> > boxes. The user selects from the first combo and then the second combo
> >> needs
> >> > to be populated from db based on the value selected.
> >> >
> >> >                 How do I call executeAction method of Action class when
> >> the
> >> > first combo box value is changed?
> >> >
> >> > Attaching my Struts-config.
> >> >
> >> >
> >> >
> >> > My JSP code snippet is thus :
> >> >
> >> > <tr>
> >> >
> >> > <td><label for="track_name">Track Name</label></td>
> >> >
> >> >                 <td><input type="hidden" value="myAction" /></td>
> >> >
> >> >                 <td><html:select name="TrackBaselineConfigActionForm"
> >> >
> >> >                                                 property="selTrackName"
> >> > onchange="this.form.myAction.value='getOsVersionAction';
> >> >
> >> >
> >> > this.form.submit();">
> >> >
> >> >                 <option value="">Select...</option>
> >> >
> >> >                 <html:optionsCollection  property="trackList"
> >> > label="selLabel" value="selLabel" />
> >> >
> >> >                 </html:select></td>
> >> >
> >> > </tr>
> >> >
> >> > <tr>
> >> >
> >> >                 <td><label for="os_version">OS Versions</label></td>
> >> >
> >> >                 <td><html:select name="TrackBaselineConfigActionForm"
> >> >
> >> >
> >> > property="osVersion">
> >> >
> >> >                 <option value="">ALL</option>
> >> >
> >> >                 <option value="">Standard Recommended Version</option>
> >> >
> >> >                 <!-- html:options name="TrackBaselineConfigActionForm"
> >> > property="osVersions" /-->
> >> >
> >> >                 </html:select></td>
> >> >
> >> > </tr>
> >>
> >> Use JavaScript to execute action and populate the second dropdown
> >>
> >>
> >> Regards
> >> --
> >> Łukasz
> >> + 48 606 323 122 http://www.lenart.org.pl/
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  

Re: Basic Struts doubt

Posted by Ken McWilliams <ke...@gmail.com>.
If using JSON this it a touch easier: http://api.jquery.com/jQuery.getJSON/
Generally best to avoid the jquery plugin, best to use jquery (and JS
in general) as you would normally.


On Mon, Oct 29, 2012 at 2:47 AM, Juan Jose Fuentes Esteban
<ju...@grupoica.com> wrote:
> I suppose you want to do that asyncronously, because if not, you just have
> to send the form and inspect the POST parameters for one with name '
> TrackBaselineConfigActionForm' .
>
> So, use javascript as Lukasz recommended you. If you use jQuery, this is the
> API function to use:
>
> http://api.jquery.com/jQuery.ajax/
>
> -----Mensaje original-----
> De: Alejandro [mailto:aparcos@gmail.com]
> Enviado el: domingo, 28 de octubre de 2012 23:56
> Para: Struts Users Mailing List
> Asunto: Re: Basic Struts doubt
>
> You could use the jquery ui. If you use struts2 there is a plugin for that.
>
> Regards :)
>
> 2012/10/28 Lukasz Lenart <lu...@apache.org>
>
>> 2012/10/28 Kakoli Sen (kasen) <ka...@cisco.com>:
>> > Hello all,
>> >
>> >     I am a newbie in Struts and JSP.
>> >
>> > My initial JSP page is coming out where I have among other widgets, 2
>> combo
>> > boxes. The user selects from the first combo and then the second combo
>> needs
>> > to be populated from db based on the value selected.
>> >
>> >                 How do I call executeAction method of Action class when
>> the
>> > first combo box value is changed?
>> >
>> > Attaching my Struts-config.
>> >
>> >
>> >
>> > My JSP code snippet is thus :
>> >
>> > <tr>
>> >
>> > <td><label for="track_name">Track Name</label></td>
>> >
>> >                 <td><input type="hidden" value="myAction" /></td>
>> >
>> >                 <td><html:select name="TrackBaselineConfigActionForm"
>> >
>> >                                                 property="selTrackName"
>> > onchange="this.form.myAction.value='getOsVersionAction';
>> >
>> >
>> > this.form.submit();">
>> >
>> >                 <option value="">Select...</option>
>> >
>> >                 <html:optionsCollection  property="trackList"
>> > label="selLabel" value="selLabel" />
>> >
>> >                 </html:select></td>
>> >
>> > </tr>
>> >
>> > <tr>
>> >
>> >                 <td><label for="os_version">OS Versions</label></td>
>> >
>> >                 <td><html:select name="TrackBaselineConfigActionForm"
>> >
>> >
>> > property="osVersion">
>> >
>> >                 <option value="">ALL</option>
>> >
>> >                 <option value="">Standard Recommended Version</option>
>> >
>> >                 <!-- html:options name="TrackBaselineConfigActionForm"
>> > property="osVersions" /-->
>> >
>> >                 </html:select></td>
>> >
>> > </tr>
>>
>> Use JavaScript to execute action and populate the second dropdown
>>
>>
>> Regards
>> --
>> Łukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Basic Struts doubt

Posted by Juan Jose Fuentes Esteban <ju...@grupoica.com>.
I suppose you want to do that asyncronously, because if not, you just have
to send the form and inspect the POST parameters for one with name '
TrackBaselineConfigActionForm' .

So, use javascript as Lukasz recommended you. If you use jQuery, this is the
API function to use:

http://api.jquery.com/jQuery.ajax/

-----Mensaje original-----
De: Alejandro [mailto:aparcos@gmail.com]
Enviado el: domingo, 28 de octubre de 2012 23:56
Para: Struts Users Mailing List
Asunto: Re: Basic Struts doubt

You could use the jquery ui. If you use struts2 there is a plugin for that.

Regards :)

2012/10/28 Lukasz Lenart <lu...@apache.org>

> 2012/10/28 Kakoli Sen (kasen) <ka...@cisco.com>:
> > Hello all,
> >
> >     I am a newbie in Struts and JSP.
> >
> > My initial JSP page is coming out where I have among other widgets, 2
> combo
> > boxes. The user selects from the first combo and then the second combo
> needs
> > to be populated from db based on the value selected.
> >
> >                 How do I call executeAction method of Action class when
> the
> > first combo box value is changed?
> >
> > Attaching my Struts-config.
> >
> >
> >
> > My JSP code snippet is thus :
> >
> > <tr>
> >
> > <td><label for="track_name">Track Name</label></td>
> >
> >                 <td><input type="hidden" value="myAction" /></td>
> >
> >                 <td><html:select name="TrackBaselineConfigActionForm"
> >
> >                                                 property="selTrackName"
> > onchange="this.form.myAction.value='getOsVersionAction';
> >
> >
> > this.form.submit();">
> >
> >                 <option value="">Select...</option>
> >
> >                 <html:optionsCollection  property="trackList"
> > label="selLabel" value="selLabel" />
> >
> >                 </html:select></td>
> >
> > </tr>
> >
> > <tr>
> >
> >                 <td><label for="os_version">OS Versions</label></td>
> >
> >                 <td><html:select name="TrackBaselineConfigActionForm"
> >
> >
> > property="osVersion">
> >
> >                 <option value="">ALL</option>
> >
> >                 <option value="">Standard Recommended Version</option>
> >
> >                 <!-- html:options name="TrackBaselineConfigActionForm"
> > property="osVersions" /-->
> >
> >                 </html:select></td>
> >
> > </tr>
>
> Use JavaScript to execute action and populate the second dropdown
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Basic Struts doubt

Posted by Alejandro <ap...@gmail.com>.
You could use the jquery ui. If you use struts2 there is a plugin for that.

Regards :)

2012/10/28 Lukasz Lenart <lu...@apache.org>

> 2012/10/28 Kakoli Sen (kasen) <ka...@cisco.com>:
> > Hello all,
> >
> >     I am a newbie in Struts and JSP.
> >
> > My initial JSP page is coming out where I have among other widgets, 2
> combo
> > boxes. The user selects from the first combo and then the second combo
> needs
> > to be populated from db based on the value selected.
> >
> >                 How do I call executeAction method of Action class when
> the
> > first combo box value is changed?
> >
> > Attaching my Struts-config.
> >
> >
> >
> > My JSP code snippet is thus :
> >
> > <tr>
> >
> > <td><label for="track_name">Track Name</label></td>
> >
> >                 <td><input type="hidden" value="myAction" /></td>
> >
> >                 <td><html:select name="TrackBaselineConfigActionForm"
> >
> >                                                 property="selTrackName"
> > onchange="this.form.myAction.value='getOsVersionAction';
> >
> >
> > this.form.submit();">
> >
> >                 <option value="">Select...</option>
> >
> >                 <html:optionsCollection  property="trackList"
> > label="selLabel" value="selLabel" />
> >
> >                 </html:select></td>
> >
> > </tr>
> >
> > <tr>
> >
> >                 <td><label for="os_version">OS Versions</label></td>
> >
> >                 <td><html:select name="TrackBaselineConfigActionForm"
> >
> >
> > property="osVersion">
> >
> >                 <option value="">ALL</option>
> >
> >                 <option value="">Standard Recommended Version</option>
> >
> >                 <!-- html:options name="TrackBaselineConfigActionForm"
> > property="osVersions" /-->
> >
> >                 </html:select></td>
> >
> > </tr>
>
> Use JavaScript to execute action and populate the second dropdown
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Basic Struts doubt

Posted by Lukasz Lenart <lu...@apache.org>.
2012/10/28 Kakoli Sen (kasen) <ka...@cisco.com>:
> Hello all,
>
>     I am a newbie in Struts and JSP.
>
> My initial JSP page is coming out where I have among other widgets, 2 combo
> boxes. The user selects from the first combo and then the second combo needs
> to be populated from db based on the value selected.
>
>                 How do I call executeAction method of Action class when the
> first combo box value is changed?
>
> Attaching my Struts-config.
>
>
>
> My JSP code snippet is thus :
>
> <tr>
>
> <td><label for="track_name">Track Name</label></td>
>
>                 <td><input type="hidden" value="myAction" /></td>
>
>                 <td><html:select name="TrackBaselineConfigActionForm"
>
>                                                 property="selTrackName"
> onchange="this.form.myAction.value='getOsVersionAction';
>
>
> this.form.submit();">
>
>                 <option value="">Select...</option>
>
>                 <html:optionsCollection  property="trackList"
> label="selLabel" value="selLabel" />
>
>                 </html:select></td>
>
> </tr>
>
> <tr>
>
>                 <td><label for="os_version">OS Versions</label></td>
>
>                 <td><html:select name="TrackBaselineConfigActionForm"
>
>
> property="osVersion">
>
>                 <option value="">ALL</option>
>
>                 <option value="">Standard Recommended Version</option>
>
>                 <!-- html:options name="TrackBaselineConfigActionForm"
> property="osVersions" /-->
>
>                 </html:select></td>
>
> </tr>

Use JavaScript to execute action and populate the second dropdown


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org