Hi, I see you are not expert in Java either ;-) Your code suggestion will lead to StackOverflowError because it goes in infinite recursion.
Wicket's Ajax behaviors are stateful. To be able to find the component that will feed the autocompleter the page should be preserved. There are some stateless Ajax behaviors provided by Jolira (https://github.com/jolira/wicket-stateless) but we have several times discussed here in the mailing list that they don't work in all use cases so they cannot be part of Wicket framework itself. Additionally #getStatelessHint() method is not final. You can always override it and tweak it until it works as you wish. But in this case obviously we will not support any problems caused by these tweaks. I recommend you to use an autocompleter provided by your favorite JS library that will get its data from either Wicket IResource or just a plain Servlet. On Thu, Mar 8, 2012 at 10:01 AM, toytown <[email protected]> wrote: > I am really facing some hard time making Autocomplete Form statless. The > problem basically stems from > AutoCompleteBehavior which extends AbstractAutoCompleteBehavior which > evetually extends AbstractAjaxBehavior. > > AbstractAjaxBehavior implements IBehaviorListener. I saw in the the > Component class that the method > public boolean getStatelessHint(Component component) > { > if (this instanceof IBehaviorListener) > { > // this behavior implements a callback interface, so > it cannot be > stateless > return false; > } > return true; > } > > So any behaviour implementing IBehaviourlistner is stateful in nature (which > I think is little too restrictive) and closes down possibility to make > AutoComplete behaviour stateless. > > Perhaps I am insane but I do not see any point why Autocomplete behaviour > should be "Stateful" all the time and in every context of Web Page. I fully > understand the advantages of being "Stateful" in most of complex web > interaction but to have a way to make some components Stateless in nature > would be nice. > > > I am not Wicket expert but I would rather do something like > > extends IBehaviorListener and include a method > > getStatelessHint(Component c) ; > > > then in org.apache.wicket.Component class implement the method > getStatelessHint in a slightly different way > > public boolean getStatelessHint(Component component) > { > if (this instanceof IBehaviorListener) > { > return this.getStatelessHint(component); > } > return true; > } > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Making-Autocomplete-Form-Stateless-tp4455817p4455817.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
