This <http://struts2inaction.com/SimpleAjax.html> should be a much simpler technique for you.
Peace, Scott On Tue, May 25, 2010 at 11:34 AM, Oscar <oscar.kalde...@gmail.com> wrote: > Hi to all, have a good day, i have a doubt about Struts 2.1.8 and AJAX > with dojo, using dojo struts tags. My doubt is the next: Suppose that > i have a combobox and when i select something in the combobox i want > to refresh another combobox using selected value of first combo, via > ajax. Then i reference to use struts dojo tags with this: > > <%@ taglib prefix="sx" uri="/struts-dojo-tags"%> > > And declare this on header (i dont't know very well why i do that but > is neccesary) > > <sx:head cache="true" /> > > after register a function in the controller: > > var controller = { > refresh : function() {} > }; > dojo.event.topic.registerPublisher("/refresh", controller, > "refresh"); > > In my form i declare s:url containing the url that will be called via ajax: > > <s:url var="urlUpdUniMedida" id="urlUpdUniMedida" > value="transTiendasEnvio!updUnisMedidaPrdAjax.action" /> > > And put a div whose content will refresh with ajax: > > <sx:div id="divLstUniMedida" autoStart="false" href="%{urlUpdUniMedida}" > preload="false" > listenTopics="/refresh" > formId="transTiendaEnvioDetForm" > > <s:select name="coduni" id="coduni" > list="#request.lstUniMedida" > listKey="coduni.coduni" > listValue="coduni.nombre" > cssStyle="width:320px;" /> > </sx:div> > > And finally, i have to do a second jsp containing the same that > contains the div in my first jsp with some code more to set things > like cache : > > <%@ taglib prefix="s" uri="/struts-tags" %> > <% > request.setAttribute("decorator", "none"); > response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 > response.setHeader("Pragma","no-cache"); //HTTP 1.0 > response.setDateHeader ("Expires", 0); //prevents caching at the > proxy server > %> > <s:select name="coduni" id="coduni" > list="#request.lstUniMedida" > listKey="coduni.coduni" > listValue="coduni.nombre" cssStyle="width:320px;" /> > > My question is: Isn't possible to avoid to do a second jsp? Can't i > just use the content of sx:div to rerender when i refresh it via ajax > instead render it using a second jsp? > > Thanks in advance. > -- > Oscar Calderón > SCJP 6 > http://www.javahowto.net/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >