在 Wicket 中重新加载代码更改
我已经开始使用 Wicket。当我对 HTML 模板进行更改时,它会立即变得可见。
但是当我更改代码时,我需要重新启动 Jetty。我正在 DEVELOPMENT
模式下运行(至少日志中的大胖警告是这么说的),并且我已经按照这个问题安装了 ReloadingWicketFilter
:Wicket - 运行时类重新加载
我的猜测是,这种行为是因为我在页面的构造函数中进行了所有更改,并且当我重新加载时,Wicket 不会创建新页面。
我浏览过 Wicket 示例,但没有示例展示如何构建 Wicket 页面而无需在构造函数中添加所有组件,或者如何告诉 Wicket 为每个请求创建一个新页面,或者如何告诉 Wicket 创建一个新页面。
I've started to work with Wicket. When I make changes to the HTML templates, that becomes visible right away.
But when I make changes to the code, I need to restart Jetty. I'm running in DEVELOPMENT
mode (at least that's what the big fat warning in the log says) and I have installed the ReloadingWicketFilter
as per this question: Wicket - runtime class reloading
My guess is that this behavior is because I make all changes in the constructor of my pages and Wicket doesn't create a new page when I reload.
I've browsed the Wicket examples but there is no example which shows how to build a Wicket page without adding all components in the constructor or how to tell Wicket to create a new page for every request or how to tell Wicket to create a new Page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我正在使用 mvn jetty:run 并在 pom.xml 中使用此配置:
并且我的 IDE (NetBeans) 配置为在保存时进行编译...然后我可以更改切换到浏览器并点击重新加载...然后更改已应用 + jetty 已重新加载
或使用商业应用程序 jrebel
I am using mvn jetty:run and this config in the pom.xml:
And my IDE (NetBeans) is configured that it compiles on save... then I can make a change switch to the browser and hit reload ... and the changes were applied + jetty was reloaded
Or use the commercial app jrebel
我认为最后一段可以通过重写 Component 的 onInitialize() 方法来解决。
请参阅http://wicket.apache。 org/apidocs/1.4/org/apache/wicket/Component.html#onInitialize()
问候,
马雷克
I think that last paragraph can be addressed by overriding Component's onInitialize() method.
See http://wicket.apache.org/apidocs/1.4/org/apache/wicket/Component.html#onInitialize()
Regards,
Marek
在 IntelliJ 中,通过调试运行 Start 应用程序。当您对 Java 进行更改并进行编译时,IntelliJ 会通过 HotSpot 重新加载该类。这些更改将在您的应用程序中可用。
当然,您会受到 HotSpot 的限制,即只能(例如)创建新类和更改方法体。
In IntelliJ, run the Start application through debugging. As you make changes to Java and compile, IntelliJ reloads the class through HotSpot. The changes become available in your application.
You are of course limited to HotSpot"s limitation of only being able to (for example) create new classes and change method bodies.