struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mileidys Gonzalez Prieto <mileidys.gonza...@i-frontier.net>
Subject Re: Struts Ajax Newbie
Date Fri, 06 Mar 2009 17:43:46 GMT
Yes, u can implement with javascript, in the onClick method of the
select, something like to change the document.src with the new address.

On Fri, 2009-03-06 at 18:34 +0100, Jiří Chaloupka wrote:
> Hi, it is working now. I do not know what concrete helped, I rewrite 
> web.xml mapping, implementing BaseAjaxServlet instead of normal servlet, 
> set base url, disable cache ...
> Now it is working.
> 
> I have one more question -is there any way to modify autocompleter - 
> after selectin one record, instead of complete other field to go to any 
> other sites, eg. list persons -> go to the detail of selected person?
> 
> Thank you
> Jiri
> 
> Mileidys Gonzalez Prieto napsal(a):
> > ok, you need to set the javascript functions
> >
> > onCreate: initProgress,
> > onComplete: resetProgress,
> > onFailure: reportError
> >
> > if you have the code of ajaxtags u can find inside the functions...
> >
> > On Thu, 2009-03-05 at 15:04 +0100, konf@chalu.cz wrote:
> >   
> >> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }Hi,
> >>  about:
> >>  >baseUrl: "http://127.0.0.1:8080/cars/FillCarModels",
> >>  >Check that the action is valid, example if u are using Struts, the
> >>  >FillCarModels need to be define like an action in the struts-config
> >>  >file.
> >>  yes, it is real URL, not to Struts action, but to servlet. It is
> >> mapped in web.xml and xml is written into response object. When I put
> >> it into separate browser window and add parameters
> >> (http://127.0.0.1:8080/cars/FillCarModels?make=1), it works. Struts
> >> actions are mapped only to *.action
> >>  But in this servlet are debug messages, which are not in log and it
> >> means that this servlet is not called :-(
> >>  Other hints - yes to all with exception of
> >>  > onCreate: initProgress,
> >>  > onComplete: resetProgress,
> >>  > onFailure: reportError,
> >>  Jiri
> >>  On Thu 05/03/09 12:54 , Mileidys Gonzalez Prieto
> >> mileidys.gonzalez@i-frontier.net sent:
> >>  Some of the reasons can be:
> >>  Well... I will give u a list of some reasons:
> >>  - baseUrl: "http://127.0.0.1:8080/cars/FillCarModels",
> >>  Check that the action is valid, example if u are using Struts, the
> >>  FillCarModels need to be define like an action in the struts-config
> >>  file.
> >>  > source: "make",
> >>  Be sure that the source select has that value in the id.
> >>  > 
> >>  > onCreate: initProgress,
> >>  > onComplete: resetProgress,
> >>  > onFailure: reportError,
> >>  Is those functions on your code? (javascript functions)
> >>  > 
> >>  > target: "model",
> >>  The target select has model in the id.
> >>  > 
> >>  > parameters: "make={make}",
> >>  > emptyOptionName: "Select model"
> >>  > });
> >>  Tell me if it's work...
> >>  On Wed, 2009-03-04 at 10:36 +0100,  wrote:
> >>  > BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px;
> >> }Hi,
> >>  > I relpaced in by javascript instead of ajaxtag, but generated by
> >>  > ajaxtag:
> >>  >  new AjaxJspTag.Select(
> >>  >  {
> >>  >  baseUrl: "http:///FillCarModels",
> >>  >  source: "make",
> >>  >  onCreate: initProgress,
> >>  >  onComplete: resetProgress,
> >>  >  onFailure: reportError,
> >>  >  target: "model",
> >>  >  parameters: "make={make}",
> >>  >  emptyOptionName: "Select model"
> >>  >  });
> >>  >  result is then 
> >>  >  new AjaxJspTag.Select(
> >>  >  {
> >>  >  baseUrl: "http://127.0.0.1:8080/cars/FillCarModels",
> >>  >  source: "make",
> >>  >  onCreate: initProgress,
> >>  >  onComplete: resetProgress,
> >>  >  onFailure: reportError,
> >>  >  target: "model",
> >>  >  parameters: "make={make}",
> >>  >  emptyOptionName: "Select model"
> >>  >  });
> >>  >  then, form contains:
> >>  >      Značka:
> >>  >      --
> >>  >      Škoda
> >>  >      Hyunday
> >>  >      Kia
> >>  >      Toyota
> >>  >  Model
> >>  >      Select model
> >>  >  Still not working ...
> >>  >  On Tue 03/03/09 14:45 , Mileidys Gonzalez Prieto
> >>  >  sent:
> >>  >   baseUrl: "${contextPath}/FillCarModels", 
> >>  >  for me looks like the url is not the real url... can y send the
> >>  > piece of
> >>  >  code where u call the ajaxtags?
> >>  >  On Tue, 2009-03-03 at 10:37 +0100,  [1] wrote:
> >>  >  > BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px;
> >>  >  > }Hallo, it is not really for this forum, but thread is already
> >>  > here.
> >>  >  >  I have following problem with ajaxtags, described in ajaxtags
> >>  > forum,
> >>  >  > but maybe it is not visited often. For javascript sources and
> >>  > function
> >>  >  > - it is the same if it is included in html head or body.
> >>  >  >  I have form in included tiles template, which has:  
> >>  >  >     ${pageContext.request.contextPath} 
> >>  >  >      Značka: 
> >>  >  >      -- 
> >>  >  >      Škoda 
> >>  >  >      Hyunday 
> >>  >  >      Kia 
> >>  >  >      Toyota 
> >>  >  >      Select model 
> >>  >  >  ... 
> >>  >  >  /cars/FillCarModel returns XML file with models for make. 
> >>  >  >  But using this not works, base URL is not called (there is
> >> some
> >>  > log
> >>  >  > messages, which are not in log). If I will use hard codded path
> >> to
> >>  >  > baseUrl, then init method of this servlet is called, but
> >> neither
> >>  >  > doGet or doPost. 
> >>  >  >  In html is generated to: 
> >>  >  >  new AjaxJspTag.Select( 
> >>  >  >  { 
> >>  >  >  baseUrl: "${contextPath}/FillCarModels", 
> >>  >  >  source: "make", 
> >>  >  >  onCreate: initProgress, 
> >>  >  >  onComplete: resetProgress, 
> >>  >  >  onFailure: reportError, 
> >>  >  >  target: "model", 
> >>  >  >  parameters: "make={make}", 
> >>  >  >  emptyOptionName: "Select model" 
> >>  >  >  }); 
> >>  >  >  Where can be problem? looks that something is not initialized
> >> ...
> >>  > 
> >>  >  >   Thanks, Jiri
> >>  >  >  On Mon 02/03/09 02:47 , Mileidys Gonzalez Prieto
> >>  >  >  [2] sent:
> >>  >  >  Well, for to do actions like that in my code I'm using
> >> AjaxTags.
> >>  >  >  http://ajaxtags.sourceforge.net/
> >>  >  >  Is really easy to use...
> >>  >  >  On Sun, 2009-03-01 at 15:47 -0800, chumbobumbo wrote:
> >>  >  >  > This is probably so basic - I'll put my flame proof suit
> >> just
> >>  > in
> >>  >  > case.
> >>  >  >  > 
> >>  >  >  > I have a 2 combos and (yes ;-) I would like the second one
> >> to
> >>  > be
> >>  >  > loaded
> >>  >  >  > depending on what's been chosen in the first one, so in my
> >>  > action
> >>  >  > execute
> >>  >  >  > method I have:
> >>  >  >  > 
> >>  >  >  >      model.setList(service.getData1());
> >>  >  >  > 
> >>  >  >  > my struts.xml looks like this (note that I am using spring
> >> and
> >>  > I
> >>  >  > am hitting
> >>  >  >  > the same action 'class' (demoAction):
> >>  >  >  > 
> >>  >  >  >                
> >>  >  >  > method="execute">
> >>  >  >  >  jsp/output.jsp
> >>  >  >  >  jsp/error.jsp
> >>  >  >  >  
> >>  >  >  >  
> >>  >  >  >  jsp/second.jsp
> >>  >  >  >  jsp/error.jsp
> >>  >  >  >  
> >>  >  >  > 
> >>  >  >  > in my output jsp I have:
> >>  >  >  > 
> >>  >  >  > .....
> >>  >  >  > 
> >>  >  >  >     
> >>  >  >  > listValue="entry.desc"  name="selection.listCode"
> >>  >  >  >     onchange="javascript:load_second_list();return
> >>  >  >  > false;">
> >>  >  >  >  
> >>  >  >  > 
> >>  >  >  >  
> >>  >  >  >  
> >>  >  >  >      
> >>  >  >  >     
> >>  >  >  > theme="ajax"
> >>  >  >  >     listenTopics="load_second_list" formId="demo"/>
> >>  >  >  >  
> >>  >  >  >  
> >>  >  >  > 
> >>  >  >  > that's all fine and dandy, but when I call loadSecond.action
> >> I
> >>  >  > find that my
> >>  >  >  > model is re-initialised anew (i.e. as the action is marked
> >>  >  > 'prototype' in
> >>  >  >  > spring config, the data for the first combo is no longer
> >> there)
> >>  > 
> >>  >  >  > 
> >>  >  >  > obviously I need data in the 1st combo to be available in
> >> the
> >>  >  > resulting
> >>  >  >  > page, as the user should be allowed to change the first
> >>  > selection
> >>  >  > (that
> >>  >  >  > would in turn relaod the second combo again). 
> >>  >  >  > 
> >>  >  >  > Is there a way to serialize/cache the data that was
> >> retrieved
> >>  > in
> >>  >  > the first
> >>  >  >  > call so that it is available in the subsequent call other
> >> than
> >>  >  > putting it in
> >>  >  >  > the session?
> >>  >  >  > 
> >>  >  >  > Thanks,
> >>  >  >  > 
> >>  >  >  > 99-L Blue 
> >>  >  > 
> >>  >  >
> >>  >
> >> ---------------------------------------------------------------------
> >>  >  >  To unsubscribe, e-mail:  [3]
> >>  > [1]
> >>  >  >  For additional commands, e-mail:  [4]
> >>  > [2]
> >>  >  > 
> >>  >  > 
> >>  >  > Links:
> >>  >  > ------
> >>  >  > [1]  [5]
> >>  >  > [2]  [6]
> >>  > 
> >>  >
> >> ---------------------------------------------------------------------
> >>  >  To unsubscribe, e-mail:  [7]
> >>  >  For additional commands, e-mail:  [8]
> >>  > 
> >>  > 
> >>  > Links:
> >>  > ------
> >>  > [1] 
> >>  > [2] 
> >>  > [3] 
> >>  > [4] 
> >>  > [5] 
> >>  > [6] 
> >>  > [7] 
> >>  > [8] 
> >>
> >> ---------------------------------------------------------------------
> >>  To unsubscribe, e-mail: 
> >>  For additional commands, e-mail: 
> >>     
> >
> >   
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message