简体   繁体   English

如何在wicket中隐藏现有页面

[英]How to hide existing page in wicket

I have web application which have some web pages. 我的网页应用程序有一些网页。 Now I want to hide them when some attribute in my configuration will be false. 现在我想在配置中的某些属性为false时隐藏它们。 With hide them I mean when someone write web page address there will be status not found. 隐藏它们我的意思是当有人写网页地址时,将找不到状态。 Is this possible in wicket ? 这是否可以在检票口?

You can throw an AbortWithHttpErrorCodeException in your page: 您可以在页面中抛出AbortWithHttpErrorCodeException

public HomePage(final PageParameters parameters) {

   if(someConditionToHidePage) {
      throw new AbortWithHttpErrorCodeException(404, "page not found");
   }
}

Hope that helps 希望有所帮助

I don't think it's possible. 我不认为这是可能的。 You could build a custom Link component that get disabled if the attribute in your configuration it's false. 您可以构建一个自定义链接组件,如果配置中的属性为false,则该组件将被禁用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM