Sohan Poonia
Sohan Poonia

Reputation: 146

Wicket model window throw error when first open in new tab by right click and then click on model window link

When i am going to one page(A) to another page(B) using Ajax link URL show like ...?wicket:interface=:58::::#

On B page i have a link for open model window.when we direct click on link of model window its working fine but when first open link in new Tab by right click and then click on model window link its throwing an error.

I am using setResponsePage( new B(variable)) for come to another page.when i am using setResponsePage(B.class) instead of setResponsePage( new B(variable)) its working fine.

Note : I don't want to use pageparameter with bookmarkable and setResponsePage.

Error is :

org.apache.wicket.WicketRuntimeException: component listForm:group:issueList:1:editStatus not found on page com.B[id = 18], listener interface = [RequestListenerInterface name=IBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()] org.apache.wicket.protocol.http.request.InvalidUrlException: org.apache.wicket.WicketRuntimeException: component listForm:group:issueList:1:editStatus not found on page com.B[id = 18], listener interface = [RequestListenerInterface name=IBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()] at ........................... ... 27 more

"editStatus" is a link name on model window.

Code that i am using Class A

class A extends WebPage {

   Link<String> escalated = new Link<String>("escalated") {

      public void onClick() {

         setResponsePage(new B(Variables));
   } };

}


class B extends WebPage {


   public B(variables..) {
   }

   final ModalWindow model = new ModalWindow("UpdateModel");

   model.setContent(new C(model,variables,model.getContentId()));

   item.add(new AjaxLink<Void>(**"editStatus"**) {
      public void onClick(AjaxRequestTarget target) {

         model.show(target);

      }
   }.add(new Image("edit_icon", "image/edit.png")));   

  }
}


class C extends Panel {

  public C(.....) {

  }
}

Upvotes: 0

Views: 997

Answers (1)

Sohan Poonia
Sohan Poonia

Reputation: 146

I have solved this issue.Error was relating with state of wicket component.

Use StatelessLink instead of Link.

correct code : class A extends WebPage {

StatelessLink escalated = new StatelessLink("escalated") {

  public void onClick() {

     setResponsePage(new B(Variables));

} };

}

it would also removed "...?wicket:interface=:58::::#" from url. when we used Link,AjaxLink it would maintain state.so when we open any link in new tab it would changed state on server side(change ids of component) but on client side it would remain same. so when we click any link on same page there are no information of updated ids and it would have thrown an error.

Upvotes: 1

Related Questions