On 9/9/06, Pierre-Yves Saumont <[EMAIL PROTECTED]> wrote:
> Hello,
> What is the best way to call a Wicket url from Javascript? Is it
> possible to have Wicket embed a link in a script? Or should I use a
> normal link, make it invisible an programmatically click on it from the
> script?

Use an attribute modifier for normal links (Wicket 2.0 code btw):

      final Link removeLink = new Link(item, "remove") {
        public void onClick() {
      removeLink.add(new SimpleAttributeModifier("onclick",
          "if(!confirm('remove discount for "
              + discount.getCheese().getName()
              + " ?')) return false;"));

Or if you use ajax links, use a call decorator:

    private class RemoveLink extends AjaxLink {
      private final Discount discount;

      private RemoveLink(ListItem<Discount> item, String id) {
        super(item, id);
        this.discount = item.getModelObject();

      public void onClick(AjaxRequestTarget target) {

      protected IAjaxCallDecorator getAjaxCallDecorator() {
        return new AjaxCallDecorator() {
          public CharSequence decorateScript(CharSequence script) {
            return "if(!confirm('remove discount for "
                + discount.getCheese().getName()
                + " ?')) return false;" + script;


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Wicket-user mailing list

Reply via email to