facelets

understand the purpose of jsf ui:composition

橙三吉。 提交于 2019-11-27 09:30:25
What is the usefulness of the following? <ui:composition template="template.xhtml">; "In a template client page using <ui:composition> , anything outside of the bounds of a tag is ignored and is not included in the rendered output" (JavaServerFaces 2.0, the complete reference, pg.61) Since everything outside <ui:define> is ignored, why put anything there? Nothing has to be put outside the <ui:define> . But doing so, all I get will be the template itself with only some "variable" parts filled. It seems not to be this big deal. Another thing I don't understand, is that template attribute of

What's the difference between <h:head> and <head> in Java Facelets?

我们两清 提交于 2019-11-27 09:16:16
See this . When and why to use <h:head> , instead of <head> ? I've seen Primefaces won't work with <head> , though. The <head> tag is a HTML tag , which defines the head of the HTML page (this is where you define metadata, or include the resources such as JavaScript or CSS for example). The <h:head> is a JSF tag (introduced with JSF 2.0) that handles the <head> part of your page. The interest of having such JSF tag is that this head becomes part of your JSF components tree, and thus, you can manipulate it in your Java code. Regarding the <head> incompatibility with Primefaces, I don't see why

How to customize JSF validation error message

笑着哭i 提交于 2019-11-27 09:13:10
How can I customize the validation message that appears when validation fails? Here is the code I have: <h:form> <p><h:inputText id="userNo" title="Type a number from 0 to 10:"> <f:validateLongRange minimum="3" maximum="6"/> </h:inputText> <h:commandButton id="submit" value="Submit" action="response"/> </p> <h:message showSummary="true" showDetail="false" id="errors1" for="userNo"/> </h:form> Currently the message looks like this: j_idt10:userNo: Validation Error: Specified attribute is not between the expected values of 3 and 6. Which is not particularly user-friendly. Daniel The simplest way

JSF/Facelets: why is it not a good idea to mix JSF/Facelets with HTML tags?

你说的曾经没有我的故事 提交于 2019-11-27 09:04:45
I've read this several times now: some developers aren't advocates of interleaving JSF/Facelets tags with HTML tags in their XHTML files. Obviously the HTML tags won't be part of the UI component tree, but what's the disadvantage of that? I often find code examples where the authors do that kind of mixing: http://www.ibm.com/developerworks/java/library/j-facelets/ http://www.packtpub.com/article/facelets-components-in-jsf-1.2 http://oreilly.com/catalog/9780596529246 "Seam in Action" also interleaves JSF/Facelets and HTML tags. I'm confused about what to actually use. I started out mixing tags,

Custom Facelet component in JSF

痞子三分冷 提交于 2019-11-27 08:47:43
Is it possible to create a custom JSF core Facelet component. Something like <custom:composition> of <ui:composition> , or <custom:include> for <ui:include> It would be helpful if someone can tell me the steps involved. Thanks in advance, Kaushal BalusC It are in essence taghandlers. I.e. classes extending from TagHandler . Here's a Hello World taghandler. com.example.HelloTagHandler public class HelloTagHandler extends TagHandler { public HelloTagHandler(TagConfig config) { super(config); } @Override public void apply(FaceletContext context, UIComponent parent) throws IOException { // Do your

Reset input fields without executing validation

狂风中的少年 提交于 2019-11-27 08:44:07
I have a Facelets view as below: <h:form id="f1"> <p:panelGrid id="p1" columns="2"> <p: inputText value="Distance Travelled::/><p:inputText value="#{airTransportUsage.distance}" immediate="true" required="true" requiredMessage="Distance Travelled Field cannot be left blank.." converterMessage="Distance Travelled must be a number" validatorMessage="Distance Travelled must be a valid number.." id="dis"> <f:validateLongRange minimum="1"/> </p:inputText> <p:commandButton value="Reset" action="#{airTransportUsage.reset}" update=":f1:p1" /> </p:panelGrid> </h:form> When the reset button is clicked,

Programmatically create and add composite component in backing bean

北城余情 提交于 2019-11-27 08:09:17
I am working with a dynamic dashboard where users can pin and remove items as they like. Now I have a problem that I want to add existing composite component to the view from the backing bean. I've tried to find correct way to do this from the internet but no success so far. Here is the simple composite component I want to add: <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:cc="http://java.sun.com/jsf/composite" xmlns:ui="http:/

Can not find the tag library descriptor for http://java.sun.com/jsf/facelets

大兔子大兔子 提交于 2019-11-27 07:53:47
I've a JSP with <%@taglib uri="http://java.sun.com/jsf/facelets" prefix="ui" %> However it errors with The absolute uri: http://java.sun.com/jsf/facelets cannot be resolved in either web.xml or the jar files deployed with this application I have libraries facelets-lib.jar and jsf-facelets-1.1.10.jar , which I suppose is Facelets, but they do not contain JSP taglib descriptors. What file is correct? BalusC Facelets is intented to replace JSP altogether. But yet you're attempting to declare it as a JSP taglib. This is never going to work. Both are distinct view technologies. Facelets is a XML

How can I remove HTML comments in my Facelets?

喜欢而已 提交于 2019-11-27 07:48:54
I would like to remove all HTML comments from my facelets before delivering to end users. Does any standard approach exist? BalusC There are actually two ways: To remove ALL comments, add this to web.xml : <context-param> <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name> <param-value>true</param-value> </context-param> or when you're still on JSF 1.2 which doesn't use Facelets as default view technology yet: <context-param> <param-name>facelets.SKIP_COMMENTS</param-name> <param-value>true</param-value> </context-param> To remove specific comments only, use <ui:remove> . <ui:remove><!

Passing EL method expression as attribute of custom Facelets tagfile

…衆ロ難τιáo~ 提交于 2019-11-27 07:19:01
问题 I created a custom JSF tag: <ui:composition> <h:panelGroup> <rich:dataScroller id="#{id}" for="#{table}" execute="#{table}" page="#{scrollerPage}" render="#{table}-sc1" maxPages="5" fastControls="hide" oncomplete="#{onCompl}" scrollListener="#{scrollListenerBean[scrollListenerMethod]}" /> <h:inputText value="#{scrollerPage}" id="#{table}-sc1" size="2"> <f:convertNumber integerOnly="true" /> </h:inputText> <h:outputText styleClass="outputText" value=" of #{scrollPagesCount} " /> <h