Domenico Santoro
Domenico Santoro

Reputation: 147

how to use setResponsePage() in wicket?

hi guys I'm trying to use the setResponsePage() method in wicket but I get an error like if the method was not implemented. Netbeans suggests me to create a method called setResponsePage ,what I'm doing wrong?

       public static void signIn(String name,String username,String password,String address,String creditCard){
        ...some stuff...
        setResponsePage(StartPage.class);
        }

Upvotes: 0

Views: 886

Answers (1)

Tekki
Tekki

Reputation: 509

You are trying to directly use the non-static method org.apache.wicket.Component#setResponsePage(Class<C>) from within in your static method.

You could do one of these:

  • If your method is defined within a Wicket Component (Page, Panel, Fragment, etc ...) remove the static keyword from it, so you can call setResponsePage(StartPage.class) directly, as you did in your example
  • Use RequestCycle.get().setResponsePage(StartPage.class). The thread calling this has to be responsible for the current HTTP Request-Response-Cycle though.
  • Pass the corresponding Wicket Component into your method and call setResponsePage(StartPage.class) on it

Upvotes: 1

Related Questions