You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stephane Cosmeur <co...@gmail.com> on 2010/04/30 06:02:50 UTC
Struts 2 and dynamics web page
Hello Struts 2 Users,
I would like to call an action when an envent onchange from a s:select
component is dispatched. According to the selected value I would like to
load data in a form in order to modify it after. To do that i would like to
call a Struts 2 action with AJAX, is it posible and is it the best solution
to perofrm it ?
In the JSP what should i do ?
Case 1: the action return a jsp page inside the main jsp page
<s:select>
@include page=form.jsp
Case 2 : the AJAX request refresh div by calling an action
<s:select>
<div>
Any help would be greatly appreciated
--
Stéphane Cosmeur
06 33 54 36 04
Re: Struts 2 and dynamics web page
Posted by Alex Rodriguez Lopez <al...@flordeutopia.pt>.
This example proved helpful to me:
http://struts2inaction.com/SimpleAjax.html
In the end I ended up doing the same with jQuery:
<s:select ... onchange="
$('#divIDthatWillGetChanged').load('some.action?' + params ); "/>
You can get the selected option and pass as params to the called action.
The action has a result that is a jsp with just the content that will
get loaded into the div (like a select).
Em 30-04-2010 05:02, Stephane Cosmeur escreveu:
> Hello Struts 2 Users,
>
> I would like to call an action when an envent onchange from a s:select
> component is dispatched. According to the selected value I would like to
> load data in a form in order to modify it after. To do that i would like to
> call a Struts 2 action with AJAX, is it posible and is it the best solution
> to perofrm it ?
>
> In the JSP what should i do ?
>
> Case 1: the action return a jsp page inside the main jsp page
> <s:select>
> @include page=form.jsp
>
> Case 2 : the AJAX request refresh div by calling an action
> <s:select>
> <div>
>
> Any help would be greatly appreciated
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org