facelets

What is the real conceptual difference between ui:decorate and ui:include?

萝らか妹 提交于 2019-11-26 12:00:48
问题 It occurs ago me that ui:decorate is functionally the same as ui:include except that you can also pass ui:param and ui:define to the included file. Am I crazy? EDIT : Although in fact you can pass ui:param to a ui:include file too, it turns out I am already doing it. Maybe you can pass a ui:define as well, I will check and edit here. 回答1: The main difference between <ui:include> and <ui:decorate> is that the <ui:decorate> is intended to allow insertion of user-defined template components,

When to use f:view and f:subview

风流意气都作罢 提交于 2019-11-26 12:00:24
问题 I am not sure what are the benefits of using <f:view> and <f:subview> . I noticed that one could write JSF pages without using them. What are the benefits of using those tags? 回答1: <f:view> The <f:view> is only useful if you want to explicitly specify/override any of the available attributes such as locale , encoding , contentType , etc or want to attach some phase listeners. E.g. <f:view locale="#{user.locale}" encoding="UTF-8" contentType="text/html"> If you don't specify it, then the sane

Passing the backing bean as a parameter to a Facelet include

依然范特西╮ 提交于 2019-11-26 11:34:37
问题 I have a Facelet that might be used in different applications. I don\'t to copy it, but reuse it. I need to pass the backing bean that will manage the view as a parameter, as some logic may vary according to the application where it is used in. I don\'t want to use a composite component, but just include the Facelet and specify which bean will manage the view. How can I achieve this? Let me give an example: <ui:composition template=\"/resources/common/templates/template.xhtml\" xmlns=\"http:/

Why is the getter called so many times by the rendered attribute?

丶灬走出姿态 提交于 2019-11-26 11:25:27
问题 Related to a previous example, i tried to monitor my get/set methods on the server (when they are called, and how often). So, my actual been look such : @ManagedBean(name=\"selector\") @RequestScoped public class Selector { @ManagedProperty(value=\"#{param.profilePage}\") private String profilePage; public String getProfilePage() { if(profilePage==null || profilePage.trim().isEmpty()) { this.profilePage=\"main\"; } System.out.println(\"GET \"+profilePage); return profilePage; } public void

Packaging Facelets files (templates, includes, composites) in a JAR

拥有回忆 提交于 2019-11-26 11:17:26
Is it possible to put JSF2 Facelets files with common content into a JAR to use it from other web applications inside e.g. <ui:composition template> , <ui:include src> , <cc:implementation> , etc? If yes, how can I achieve this? Is some extra configuration necessary? You can put common resources in the /META-INF/resources folder of the JAR which is to be treated like as /WEB-INF/resources folder of the WAR. E.g. CommonWebProject |-- META-INF | |-- resources | | `-- common | | |-- css | | | `-- some.css | | |-- js | | | `-- some.js | | |-- images | | | `-- some.png | | |-- components | | | `--

The entity name must immediately follow the &#39;&&#39; in the entity reference

痞子三分冷 提交于 2019-11-26 10:21:15
I want to put a packman game on my *.xhtml page.(I am using jsf 2 and primefaces 3.5) However, when I "translated" the html page in xhtml I get an error at this script: <script> var el = document.getElementById("pacman"); if (Modernizr.canvas && Modernizr.localstorage && Modernizr.audio && (Modernizr.audio.ogg || Modernizr.audio.mp3)) { window.setTimeout(function () { PACMAN.init(el, "./"); }, 0); } else { el.innerHTML = "Sorry, needs a decent browser<br /><small>" + "(firefox 3.6+, Chrome 4+, Opera 10+ and Safari 4+)</small>"; } </script> At line: if (Modernizr.canvas && Modernizr

Changing JSF prefix to suffix mapping forces me to reapply the mapping on CSS background images

狂风中的少年 提交于 2019-11-26 09:51:05
问题 I\'ve been using prefix mapping for years and decided to switch to suffix mapping, just to get rid of the /faces in the url really. I just wanted to check I\'m going in the right direction before I dig myself a hole as there are a few unexpected things going on. I changed from this: <servlet-mapping> <servlet-name>FacesServlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> to this: <servlet-mapping> <servlet-name>FacesServlet</servlet-name> <url-pattern>*.xhtml</url

Java EE6> Packaging JSF facelets (xhtml) and ManagedBeans as JAR

一曲冷凌霜 提交于 2019-11-26 09:44:46
问题 Is it possible to package JSF facelets and ManagedBeans into a JAR file? So that we can use this code and UI combination in different war/ear projects? I am not talking about JSF Components! If yes - can you point me to a tutorial or blog post I need details about the Jar structure and additional files needed in the Jar? Thanks Max 回答1: Yes, that's definitely possible, assuming that you're using JSF 2.0, part of Java EE 6. As to the managed beans and other JSF classes like validators,

Opening Facelets page errors with “This XML file does not appear to have any style information associated with it.”

谁说我不能喝 提交于 2019-11-26 09:33:55
问题 I\'m trying to run my Eclipse JSF project on Apache Tomcat on other computer. I created a WAR file with this tutorial. However, when I deploy the WAR and open the Facelet page in Firefox, I\'m getting only the following error message: This XML file does not appear to have any style information associated with it. The document tree is shown below. This my first time when I try run my JSF app without Eclipse. How is this caused and how can I solve it? I\'m actually trying to open the following

How to show user-friendly error page in browser when runtime exception is thrown by servlet?

我们两清 提交于 2019-11-26 09:23:51
问题 I\'m developing web-application with JSF. I tested it as I was able to but from time to time runtime exceptions are thrown. So, how to redirect user to special error page every time an exception is thrown (instead of displaying 500 Error with full tomcat logs)? 回答1: Just declare an <error-page> in web.xml wherein you can specify the page which should be displayed on a certain Throwable (or any of its subclasses) or a HTTP status code. E.g. <error-page> <exception-type>java.lang.Exception<