自动整理JSP/JSF文件

发布于 2024-08-26 07:58:12 字数 256 浏览 9 评论 0原文

我正在开发一个 Web 应用程序,并且在编辑器中完成大部分 XHTML 工作。 每隔一段时间,我就会忘记关闭标签或弄乱嵌套(有时我们都会分心;-))。

因此,我编译、打包并运行我的 web 应用程序(使用 maven mvn clean package jetty:run-war 只注意到显示视图(我搞乱了 jsp 的地方)在尝试渲染时失败并出现异常所以

我想知道: 是否有一些工具可以包含在我的构建周期中,自动捕获并纠正那些粗心的错误?

I am working on a webapplication and I do most of the XHTML stuff in an editor.
Every once in a while I froget to close a tag or mess up the nesting (we all get distracted sometimes ;-)).

So I commpile, package and run my webapp (using maven mvn clean package jetty:run-war only to notice that displaying the view (where I messed up the jsp) fails with an exception while trying to render.

So I wondered:
Is there some tool that I can include into my build-cycle that automatically catches and rectifies those careless mistakes?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

墨小沫ゞ 2024-09-02 07:58:12

Maven CheckStyle 插件,它查看 Java 中的某些样式规则,其他语言。它是可定制的,因此您可以添加其他规则。我不能肯定地说它会捕获未封闭的标签,但这可能是开始的地方。

使用 Ecplipse 或 Netbeans 等 IDE 也会突出显示任何无效代码。因此,当您键入时,您实际上可以在页面上看到红色标记。这可能会更有效。

There is the Maven CheckStyle plugin that looks at certain style rules in Java and other languages. It is customisable so you can add other rules. I can't say for sure that it will catch unclosed tags but this may be the place to start.

Using an IDE like Ecplipse or Netbeans will highlight any invalid code also. So you can actually see a red mark on the page as you type. That may be even more effective.

_蜘蛛 2024-09-02 07:58:12

也许常规的 xml 检查器就可以解决问题。毕竟,如果正确编写,JSP 文件就是有效的 xml。

Maybe a regular xml checker would do the trick. After all a JSP file is if properly written valid xml.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文