有没有办法在不构建整个项目的情况下运行JSF页面?

编程入门 行业动态 更新时间:2024-10-27 20:24:05
本文介绍了有没有办法在不构建整个项目的情况下运行JSF页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有没有办法只运行一个页面,这样我就可以看到生成的html(和css),即使它本质上是非功能性的,它也会向用户看?独立的JSF页面。我想在实际编写表单字段之前,先查看我如何设置表单以确定它们是否符合用户的观点。我正在使用maven和netbeans,但不确定后者是否相关。

Is there a way to just run the one page so that I can see the generated html (and css) as it would look to the user even if it is essentially non-functional? Standalone JSF page as it were. I want to review how I am setting up forms to see if they make sense form a user standpoint before actually coding for the form's fields. I'm using maven and netbeans but not sure if the latter is relevant.

推荐答案

如果你正在使用JSF2 Facelets,那么您可以使用纯HTML设计表单,并使用 jsfc 属性指定应在JSF运行时使用的相应JSF组件。例如,

If you're using JSF2 Facelets, then you can just design your forms with plain HTML and use the jsfc attribute to specify the respective JSF component which should be used during JSF runtime. E.g.

<form jsfc="h:form"> <label jsfc="h:outputLabel" for="input1" /> <input type="text" jsfc="h:inputText" id="input1" value="#{bean.input1}" required="true" /> <span jsfc="h:message" for="input1" /> <input type="submit" jsfc="h:commandButton" value="Submit" action="#{bean.submit}" /> </form>

阅读Facelets < ui:xxx> taglib文档也应提供一些见解。例如,

Reading the Facelets <ui:xxx> taglib documentation should also give some insights. E.g.

<span jsfc="ui:remove"> This is present during design time, but is removed during JSF runtime. </span> <div jsfc="ui:repeat" value="#{bean.items}" var="item">#{item}</div> <table> <tr jsfc="ui:repeat" value="#{bean.items}" var="item"> <td>#{item.id}</td> <td>#{item.name}</td> </tr> </table>

您可以使用< ui:composition> 指定Facelet组合的开始和结束(例如包含文件或标记文件)。外部的任何内容都将在运行时被忽略,但您仍然可以在设计时放置一些HTML,以便您可以轻松预览包含文件或标记文件应该包含在其中的完整设计。

And the fact that you can use <ui:composition> to specify the start and end of a Facelet composition (e.g. an include file or a tag file). Any content outside will be disregarded during runtime, but you can still put some HTML around during designtime so that you can easily preview complete designs in which the include file or tag file is supposed to be part of.

<!DOCTYPE html> <html lang="en" xmlns="www.w3/1999/xhtml" xmlns:f="java.sun/jsf/core" xmlns:h="java.sun/jsf/html" xmlns:ui="java.sun/jsf/facelets" > <head> ... </head> <body> ... <ui:composition> Here you can design content of include file or tag file as if it's part of the whole design. </ui:composition> ... </body> </html>

这一切都允许您预览HTML / CSS设计而无需JSF运行时。

This all allows you to preview HTML/CSS designs without needing a JSF runtime.

更多推荐

有没有办法在不构建整个项目的情况下运行JSF页面?

本文发布于:2023-11-23 09:17:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1620910.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:没有办法   情况下   页面   项目   JSF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!