facelets

JSF2: limiting cc:attribute to a given object type within a List

非 Y 不嫁゛ 提交于 2020-01-12 05:53:33
问题 If I had a managed bean as follows: @ManagedBean @RequestSchoped public class Example { private List<String> stringList; private List<Long> longList; // getters, setters, etc. down here } and had a custom component which accepted a List as an attribute: <?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

JSF2: limiting cc:attribute to a given object type within a List

假装没事ソ 提交于 2020-01-12 05:53:13
问题 If I had a managed bean as follows: @ManagedBean @RequestSchoped public class Example { private List<String> stringList; private List<Long> longList; // getters, setters, etc. down here } and had a custom component which accepted a List as an attribute: <?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

JSF2: limiting cc:attribute to a given object type within a List

与世无争的帅哥 提交于 2020-01-12 05:53:05
问题 If I had a managed bean as follows: @ManagedBean @RequestSchoped public class Example { private List<String> stringList; private List<Long> longList; // getters, setters, etc. down here } and had a custom component which accepted a List as an attribute: <?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

How to disable elements from within a ViewHandler after jsf has embedded the composite component?

喜欢而已 提交于 2020-01-11 12:32:35
问题 I'm using a ViewHandler to block all input elements on any accessed page, if certain criteria is met. This works great for the input elements in the 'primary' xhtml files, but the input elements within composite components aren't being blocked. I figured it has to do with the fact that JSF embeds these components only after my ViewHandler has finished it's job. Does anyone have an idea of how I can disable the elements in the composite as well? 回答1: A ViewHandler is the wrong tool for the job

Jsf How to create a Naming Container

此生再无相见时 提交于 2020-01-09 18:24:52
问题 I have a problem with duplicated ids in my JSF app. I've read in this post that one of the possible solutions is to use Naming Container. Can you give me some example how to use the Naming Container to avoid duplicated ids problem? I use Facelets. 回答1: This is what worked for me using JSF1.2 and facelets: I discovered that neither <ui:composition> nor <ui:component> is actually a naming container, so using the same component more than once in the same form would fail with a duplicate ID

Jsf How to create a Naming Container

岁酱吖の 提交于 2020-01-09 18:23:50
问题 I have a problem with duplicated ids in my JSF app. I've read in this post that one of the possible solutions is to use Naming Container. Can you give me some example how to use the Naming Container to avoid duplicated ids problem? I use Facelets. 回答1: This is what worked for me using JSF1.2 and facelets: I discovered that neither <ui:composition> nor <ui:component> is actually a naming container, so using the same component more than once in the same form would fail with a duplicate ID

Include dynamic content containing JSF tags/components from stream

╄→尐↘猪︶ㄣ 提交于 2020-01-09 03:52:05
问题 I am working on an application where I would like to include dynamic XHTML content from a stream. To handle this I wrote a taghandler extension which dumps the dynamic XHTML content to output component as UIOutput htmlChild = (UIOutput) ctx.getFacesContext().getApplication().createComponent(UIOutput.COMPONENT_TYPE); htmlChild.setValue(new String(outputStream.toByteArray(), "utf-8")); This works fine for XHTML content which has no JSF tags. If I have JSF tags in my dynamic XHTML content like

Javascript does not work under JSF template again

时光怂恿深爱的人放手 提交于 2020-01-07 07:37:10
问题 I have found the thread answered by BalusC It describes the exact problem I have. When I found it I thought I have found my answer as well, but for me the solution is not working. I had problems with the < h:outputScript> tag already, maybe it is the same problem (the < script> tag is working). I have the same project description as the user Plaha, that put the question. I am trying to call a JavaScript function defined in the template page with the parameters attributes of the backing JSF

Is it ok to use a ui:repeat inside a ui:include

允我心安 提交于 2020-01-06 15:18:18
问题 We all know the difference between build time and render time. It is definitely not a great idea to put a <ui:include> tag (build time) inside a <ui:repeat> (render time), but is the opposite okay to do? Can we use <ui:repeat> inside a <ui:include> ? 回答1: Both ways are OK. It is definitely not a great idea to put a <ui:include> tag (build time) inside a <ui:repeat> (render time) This is not true. You can safely do so. The only limitation is that you can't use the var of <ui:repeat> inside src

Facelets charset problem

旧街凉风 提交于 2020-01-06 03:15:26
问题 In my earlier post there was a problem with JSF charset handling, but also the other part of the problem was MySQL connection parameters for inserting data into db. The problem was solved. But, I migrated the same application from JSP to facelets and the same problem happened again. Characters from input fields are replaced when inserting to database (č is replaced with Ä), but data inserted into db from sql scripts with proper charset are displayed correctly. I'm still using registered