JSPX 新手 - Dillemas

发布于 2024-12-28 06:47:58 字数 880 浏览 0 评论 0原文

我刚刚开始在一个工作项目中尝试使用 JSPX 和 ICEfaces。我想知道使用 .JSPX 的最佳标准以及最小化页面代码的最佳方法。

我之前曾使用过 PHP、asp.NET 和 Java,所以您可以了解我的背景。

我有一些问题:

首先,JSPX 是否使用某种母版页,如果没有,我想使用“include”将是减少重复代码的最佳方法。但是我仍然无法摆脱整个标题,因为我需要标题标签,除非有办法解决!?

第二个问题是,JSP 转储的 html 有时无效。例如,这是无效的 html 声明: ,并且还有其他类似的问题。我知道 Stack Overflow 上还有另一篇关于此问题的文章,但主要针对自闭合标签,没有提到文档类型问题。

如果您能帮助我解决当前的问题,我将不胜感激,如果您有一些好的教程,请分享。我想要的是创建可维护的代码并尽可能减少页面中的代码(例如包含页眉和页脚文件,因此您只有 1 个文件中的代码)。

更新(BalusC 评论):

这些是我的 .jspx 文件中的前三行:

<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ice="http://www.icesoft.com/icefaces/component">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>

I have just started experimenting with JSPX and ICEfaces for a work project. I would like to know the best standards used to work with .JSPX and the best way to minimize code from pages.

I had worked with PHP, asp.NET, and Java before so you get an idea of my background.

I have some issues:

First of all, does JSPX use some kind of Master Page, if not I guess using "include" would be the best way to reduce repeated code. However I still cannot get rid of the whole header because I need the Title tag, unless this has a way around!?

The second issue is, that the html dumped by JSP is sometimes not valid. For example this is the html declaration: <html id="document:html" lang="en"> which is not valid, and there are other similar issues. I know there is another post about this on Stack Overflow, but that targets mainly self closing tags, doesn't mention the doctype issue.

I would appreciate if you can help me with my current issues, and if you have some good tutorials please share. What I would like is to create maintainable code and reduce code in pages as much as possible (for example include header and footer files, so you only have those in 1 file).

Update (BalusC Comment):

These are the first three lines I have in my .jspx file:

<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ice="http://www.icesoft.com/icefaces/component">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文