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:jcompag...@gmail.com]
Gesendet: So 07.06.2009 00:25
An: users@wicket.apache.org
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 <lind...@visionet.de> 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:jcompag...@gmail.com]
> Gesendet: Sa 06.06.2009 23:28
> An: users@wicket.apache.org
> 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 <lind...@visionet.de> 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: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to