我应该把HTML和Java文件中的Apache Wicket的同一个包(文件夹)? [英] Should I put html and java files in the same package (folder) in Apache Wicket?

查看:151
本文介绍了我应该把HTML和Java文件中的Apache Wicket的同一个包(文件夹)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是否有一个例子HTML文件和java文件驻留在不同的文件夹。

I wonder if there is an example which html files and java files are resides in different folders.

推荐答案

我不建议使用一个单独的页面目录中,除非你是一个资源流如何工作,我不太舒服。

I don't recommend using a separate page directory unless you are quite comfortable with how resource streams work, which I am not.

绝大多数检票项目我看到守在源目录类和HTML文件。我试图把它们分开自己,但随后发现,让其他资源我的手,像图像和这样的,是一个麻烦;所以,我结束了把这些资源包目录 - 到底我有资源,几个不同的地方,它是一个多乱七八糟比将一切都在包目录本来的。

The vast majority of wicket projects I have seen keep class and html files in the source directory. I tried separating them myself but then found that getting my hands on other resources, like images and such, was a hassle; so, I wound up putting those resources in the package directory - in the end I had resources in several different places and it was more of a mess than putting everything in package directory would have been.

这是说,这里的code我曾经把我的HTML模板在一个单独的文件夹中。它应该在你的应用程序类添加到的init()

That said, here's the code I used to put my html templates in a separate folder. It should be added to Init() in your application class.

IResourceSettings resourceSettings = getResourceSettings();
resourceSettings.addResourceFolder("pages"); //the full path to your folder, relative to the context root
resourceSettings.setResourceStreamLocator((IResourceStreamLocator) new PathStripperLocator());

https://cwiki.apache.org/confluence/display/WICKET/Control+where+HTML+files+are+loaded+from对本教程。

这篇关于我应该把HTML和Java文件中的Apache Wicket的同一个包(文件夹)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆