You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alfredo Manuel Osorio Martinez <al...@afirme.com> on 2011/02/05 01:03:08 UTC

Strus 2 populate select dynamically

What's the best approach to populate a select box dynamically?

 

Imagine I need select boxes for the following fields (vehicle):

Make

Model

Year

 

Each of them are linked. If I select Make model should refresh and so
for model and year.

 

I was thinking about using <s:action/> tag  to render the output but
I've heard that's not recommended.

 

Also I've heard that you should implement it in the prepare() method of
the Preparable interface but I have my doubts because what if I need to
use those select boxes across different jsp pages, should I repeat the
same logic through all those prepare() methods of their respective
Actions?

 

Another approach would be to use javascript and get the values through
AJAX.

 

Or should I use JSP custom tags?

 

What do you think? What do you suggest?

 

Alfredo Osorio


Re: Strus 2 populate select dynamically

Posted by tito <ti...@gmail.com>.
If you do not like the screen to be refreshed/reloaded.. you can use
ajax..perhaps with jquery.It will be soothing for the users of the screen.





regards,
Tito Cheriachan
http://www.titocheriachan.com


___________________________________________




10 litres of water is required to produce a sheet of paper.
--



On Sat, Feb 5, 2011 at 4:03 AM, Alfredo Manuel Osorio Martinez <
alfredo.osorio@afirme.com> wrote:

> What's the best approach to populate a select box dynamically?
>
>
>
> Imagine I need select boxes for the following fields (vehicle):
>
> Make
>
> Model
>
> Year
>
>
>
> Each of them are linked. If I select Make model should refresh and so
> for model and year.
>
>
>
> I was thinking about using <s:action/> tag  to render the output but
> I've heard that's not recommended.
>
>
>
> Also I've heard that you should implement it in the prepare() method of
> the Preparable interface but I have my doubts because what if I need to
> use those select boxes across different jsp pages, should I repeat the
> same logic through all those prepare() methods of their respective
> Actions?
>
>
>
> Another approach would be to use javascript and get the values through
> AJAX.
>
>
>
> Or should I use JSP custom tags?
>
>
>
> What do you think? What do you suggest?
>
>
>
> Alfredo Osorio
>
>