您很可能会看到以下内容:
Last cause: The component(s) below failed to render. Possible reasons could be that: 1) you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered), 2) if your components were added in a parent container then make sure the markup for the child container includes them in <wicket:extend>.
1. [WebMarkupContainer [Component id = link]]
2. [BrowserInfoForm [Component id = postback]]
3. [Form [Component id = postback]]
4. [TextField [Component id = navigatorAppName]]
5. [TextField [Component id = navigatorAppVersion]]
6. [TextField [Component id = navigatorAppCodeName]]
7. [TextField [Component id = navigatorCookieEnabled]]
8. [TextField [Component id = navigatorJavaEnabled]]
9. [TextField [Component id = navigatorLanguage]]
10. [TextField [Component id = navigatorPlatform]]
11. [TextField [Component id = navigatorUserAgent]]
12. [TextField [Component id = screenWidth]]
13. [TextField [Component id = screenHeight]]
14. [TextField [Component id = screenColorDepth]]
15. [TextField [Component id = utcOffset]]
16. [TextField [Component id = utcDSTOffset]]
17. [TextField [Component id = browserWidth]]
18. [TextField [Component id = browserHeight]]
19. [TextField [Component id = hostname]]
大多数这些组件都在BrowserInfoForm
并且实际上是需要的,以便表单收集信息。
“链接”和“回发”组件在 中BrowserInfoPage
,因此如果您将其子类化,则必须在您的 html 标记中。
标记可能会因检票口版本而BrowserInfoPage
略有不同(但可能不会太大)。我的是:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:wicket="http://wicket.apache.org">
<head>
<meta wicket:id="meta" http-equiv="refresh" />
</head>
<body onload="javascript:submitform();">
If you see this, it means that both javascript and meta-refresh are not support by
your browser configuration. Please click <a wicket:id="link" href="#">this link</a> to
continue to the original destination.
<div wicket:id="postback"></div>
</body>
</html>
为了完成收集客户信息的工作,您的标记需要包含<body onload="javascript:submitform();">
“回发”部分中的表单本身。
您所看到的可能是以“如果您看到这个......”开头的消息。在我尝试重现您的问题时,我从未见过这种情况,但我怀疑它可能会在刷新/重定向到原始目的地之前显示片刻。您可以通过对“CustomBrowserInfoPage.html”使用类似的内容来消除它:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:wicket="http://wicket.apache.org">
<head>
<meta wicket:id="meta" http-equiv="refresh" />
</head>
<body onload="javascript:submitform();">
<a wicket:id="link" href="#"></a>
<div wicket:id="postback"></div>
</body>
</html>
如果其中的任何字段BrowserInfoForm
可见,则隐藏它们会更加麻烦。但我认为他们无论如何都不会出现。
但是请注意,如果您这样做,禁用 JavaScript 的人将看到一个空白页面并且无法访问您的真实页面。这就是消息和“链接”的原因。