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.
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>
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>
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>
This all allows you to preview HTML/CSS designs without needing a JSF runtime.
JBoss Tools for Eclipse have rudimentary support for JSF-tags in their visual editor.
I played briefly with it, but it did not support our legacy pages fully, so I left it at that. It may work better when starting with a blank page.
You can not execute a JSF page directly without deploying the built application. You have to deploy it, and only then will you be able to display executed the page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With