有没有办法在不构建整个项目的情况下运行JSF页面? [英] Is there a way to run a JSF page without building the whole project?

查看:111
本文介绍了有没有办法在不构建整个项目的情况下运行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="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/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页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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