I want to trigger a method of a wicket component from  a self written 
JavaScript function e.g.
 
     <script>
          onClick....call 'WicketAjax
     </script>
 
So I create an AjaxBehavior that extends AbstractAjaxBehavior oder 
AbstractDefaultAjaxBehavior and add it to a Wicket Component.
 
My class implements the onComponentRendered method jut like this 

     String func = "function() { wicketAjaxGet('" + this.getCallbackUrl() + 
"'); }"

     RequestCycle tequestCycle = RequestCycle.get();

     Response response = tequestCycle.getResponse();

     response.write(builder.toScriptTag());

And because getCallbackUrl does not escape the & the raw & is rendered into the 
page. This is nor problem for functionality (everything works well) but it 
makes html debugging hard because of the validation errors caused by &.

Now I can do the encodeing by myself but then the wicketAjaxGet fires the 
respond method wit all parameters named "&amp;paramName".

Now I can call 

     getComponent().getRequest().getParameter("&amp;paramName")

in the respond method but this looks strange for me.

If this is the intended way to do such things I will do them so.


________________________________

Von: Johan Compagner [mailto:[email protected]]
Gesendet: So 07.06.2009 00:25
An: [email protected]
Betreff: Re: Ajax URL encoding and &



ahh yes it is the ajax event behavior that is altered
(thats an behavior that is attached to events so on attributes like onclick)

which behavior do you exactly use and where is it exactly inserted in?

On Sun, Jun 7, 2009 at 00:13, Stefan Lindner <[email protected]> wrote:

> Looking into current trunk (1.4):
> The only Class that extends AbstractAjaxBrhavior is
> AbstractDefaultAjaxBehavior. In both classes the onComponentTag method does
> nothingI should overwrite the onComponentTag method and escape all & to
> &amp;?
> But when I do this, the ajax callback no longer works.
>
> ________________________________
>
> Von: Johan Compagner [mailto:[email protected]]
> Gesendet: Sa 06.06.2009 23:28
> An: [email protected]
> Betreff: Re: Ajax URL encoding and &
>
>
>
> This should be fixed in the current trunk i think
>
> yes getCallbackUrl doesnt escape the markup yet
> But the onComponentTag of the AjaxBehaviors should escape it right before
> it
> gets inserted into the attributes markup.
>
>
>
> On Sat, Jun 6, 2009 at 20:34, Stefan Lindner <[email protected]> wrote:
>
> > In current wicket 1.4 trunk a call to
> >
> >     AbstractAjaxBehavior.getCallbackUrl
> >
> > Returns something like
> >
> >
> > wicketAjaxGet('?wicket:interface=:0:comp1:comp2::IActivePageBehaviorList
> > ener:1:&wicket:ignoreIfNotActive=true'); };
> >
> > The Firefox html validator plugins don't accept this as correct urls.
> > They tell me
> >
> >     "cannot generate system identifier for general enttiy
> > wicket:ignoreIfNotActive"
> >
> > And tell me to replace the "&" by "&amp;" but this breaks
> > wicketAjaxGet's functionality.
> > Is there any trick to get this fixed (besides the option not to use
> > strict html).
> >
> > Stefan.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to