Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 六号门!继续原始目的地:接线员!是未定义的 处境_Java_Jakarta Ee_Migration_Wicket 1.5_Wicket 6 - Fatal编程技术网

Java 六号门!继续原始目的地:接线员!是未定义的 处境

Java 六号门!继续原始目的地:接线员!是未定义的 处境,java,jakarta-ee,migration,wicket-1.5,wicket-6,Java,Jakarta Ee,Migration,Wicket 1.5,Wicket 6,我正在将一个项目从Wicket 1.5.7迁移到Wicket 6.12,下面将解释我遇到的一个错误 代码 错误 这是我在更改wicket版本时遇到的错误:运算符! 参数类型void未定义 注意:我在将鼠标悬停在上时看到此错误!继续原创目标 我试了什么 在搜索stackoverflow时,我遇到了以下问题: 还检查了apache wicket上的此主题: 因此,我将代码更改为: 问题: 在我的特殊情况下,旧情况和代码更改似乎都起作用 也许这只是一个小小的改变,是我的新代码错了吗,这应该如何工

我正在将一个项目从
Wicket 1.5.7
迁移到
Wicket 6.12
,下面将解释我遇到的一个错误

代码 错误 这是我在更改wicket版本时遇到的错误:运算符! 参数类型void未定义

注意:我在将鼠标悬停在
上时看到此错误!继续原创目标

我试了什么 在搜索stackoverflow时,我遇到了以下问题:

还检查了apache wicket上的此主题:

因此,我将代码更改为:

问题: 在我的特殊情况下,旧情况和代码更改似乎都起作用

  • 也许这只是一个小小的改变,是我的新代码错了吗,这应该如何工作
  • Wicket改变了那么多,以至于旧代码不再受支持,或者可以
    !是否也可以使用continueToOriginalDestination
这很有帮助

在1.5中,您可以执行以下操作来中断一个页面的呈现,转到另一个页面(如登录页面),然后将用户发送回他/她所在的位置:

  public class BuyProductPage extends WebPage {
      public BuyProductPage() {
        User user = session.getLoggedInUser();
        if (user  null) {
          throw new RestartResponseAtInterceptPageException(LoginPage.class);
        }
      }
  }
然后在LoginPage.java中,在用户登录后将其重定向回BuyProductPage:

  public class LoginPage extends WebPage {
    public LoginPage() {
      // first, login the user, then check were to send him/her:
      if (!continueToOriginalDestination()) {
        // redirect the user to the default page.
        setResponsePage(HomePage.class);
      }
    }
  }
Wicket 6中的continueToOriginalDestination方法已更改,它现在是void,这使您的代码看起来更神奇,逻辑性更低:

  public class LoginPage extends WebPage {
    public LoginPage() {
      // first, login the user, then check were to send him/her:
      continueToOriginalDestination();
      // Magic! If we get this far, it means that we should redirect the
      // to the default page.
      setResponsePage(HomePage.class);
    }
  }
  public class LoginPage extends WebPage {
    public LoginPage() {
      // first, login the user, then check were to send him/her:
      if (!continueToOriginalDestination()) {
        // redirect the user to the default page.
        setResponsePage(HomePage.class);
      }
    }
  }
  public class LoginPage extends WebPage {
    public LoginPage() {
      // first, login the user, then check were to send him/her:
      continueToOriginalDestination();
      // Magic! If we get this far, it means that we should redirect the
      // to the default page.
      setResponsePage(HomePage.class);
    }
  }