jsf-2

Primefaces static and dynamic columns in datatable

大憨熊 提交于 2019-12-17 04:34:11
问题 I am using Primefaces 5.0 to create a dynamic datatable. My DataObject has some required fields and a List of optional "tupel" (key-value pair). The optional list may vary in size. Therefore I need a dynamic mechanism to show a List of DataObject in Primefaces.DataTable. My approach looks like: public class DataObject { private String staticval1; private String staticval2; private List<Tupel> optionalValues; // .. getter, setter, hashCode, toString..... } public class Tupel{ private String id

Avoiding duplicate ids when reusing facelets compositions in the same naming container

最后都变了- 提交于 2019-12-17 04:02:14
问题 I have a <ui:composition> that contains a few elements with explicit ids and some ajax events which reference these ids for partial processing/updating. I encapsulated this fragment of xhtml inside the composition simply so I could use it in a few different places without having to duplicate the code. However, when I use the composition (with <ui:include> ) more than once inside a page, I get duplicate id exceptions. It seems JSF is not wrapping each composition inside its own naming

How do UISelectOne and UISelectMany components preselect defaults in f:selectItems

非 Y 不嫁゛ 提交于 2019-12-17 03:19:18
问题 I know how to preselect <p:selectOneMenu> , in selected value should be one of the objects from <f:selectItems> , but how does this component work under the hood and can I change this behavior? In my case I've a duplicate object, actually this is two objects with the same values but created twice and selected object in <p:selectOneMenu> differs from object from <f:selectItems> and it doens't recognize it. Most likely I will change my design so, it will point to same object but in case I can't

i18n with UTF-8 encoded properties files in JSF 2.0 application

一笑奈何 提交于 2019-12-17 03:17:40
问题 I am using jsf-ri 2.0.3 where Hebrew and Russian support is needed. The problem is that I see gibberish on the screen instead of the correct text. First of all I have defined bundles (*_locale.properties) for each language. The files is in UTF-8 encoding. Secondly, I've defined the default and supported locales in faces-config.xml <locale-config> <default-locale>iw</default-locale> <supported-locale>en</supported-locale> <supported-locale>ru</supported-locale> </locale-config> Than I've added

Difference between Mojarra and MyFaces

柔情痞子 提交于 2019-12-17 03:07:08
问题 I am starting on JSF2.0 I used a tutorial as a reference but I have the following question: The tutorial used 2 libs only: jsf-api.jar , jsf-impl.jar (but also had JSTL) from Mojarra Project. I tried to dowload them also but seems the site is not reachable. So I used Apache MyFaces but to run the example I had to add 8 jars ( commons-* , myfaces-* ). Why do I need more jars if I use MyFaces? Should I prefer Mojarra as lighter? Also the download page is indeed JSF Mojarra? Thanks 回答1: Why do I

How make commandButton not fully refresh page? How to use f:ajax?

血红的双手。 提交于 2019-12-17 02:51:23
问题 I have to stream a webcam video, so I use ustream to do that, which generate a flash embed code for me, and I have a button to turn off/on the light, but when I press the button it refresh the whole page and so the flash component. There's some way to not refresh the page and still send to command ? Well for now it's this way: <h:form id="form_supervisory"> <h:panelGrid> <h:column> <iframe width="480" height="296" src="http://www.ustream.tv/embed/9599890" scrolling="no" frameborder="0" style=

com.sun.faces.numberOfViewsInSession vs com.sun.faces.numberOfLogicalViews

我怕爱的太早我们不能终老 提交于 2019-12-17 02:34:24
问题 Mojarra Implementation of JSF 2 has the following context params: com.sun.faces.numberOfViewsInSession (default is 15) com.sun.faces.numberOfLogicalViews (default is 15) What is the difference between them? The documentation doesn't speak much about these. My app was having trouble with ViewExpiredException for some pages, but after we bumped these settings to a (much) higher value, we stopped having problems. My app is a financial, form-heavy, ajax-enabled app (some screens have 50+ inputs,

What is the correct way to deal with JSF 2.0 exceptions for AJAXified components?

隐身守侯 提交于 2019-12-17 02:31:52
问题 I have set up web.xml so that anything that's java.lang.Throwable (i.e. any uncaught exceptions or errors) will forward to an error page. However, for AJAXified components, exceptions dont get routed to the error page via this mechanism. The test case I have is a simple CommandButton tied to an action method that always throws a RuntimeException . It seems like the best practice would be to have the action method catch the exception and add a FacesMessage of type error severity. Is this what

Is it suggested to use h:outputText for everything?

試著忘記壹切 提交于 2019-12-17 02:24:24
问题 I'm new to JSF (just started learning about it 4 days ago) and I'm a bit confused about the usage of h:outputText. I know that is a simple tag, but in most examples I've seen, it's used to output very simple (no need to escape), non-i18n text. For example (taken from here) <h:outputText value="Transport" /> which could be replaced by Transport So, I'm wondering if I'm missing something or if most of the examples I've seen are overcomplicated to the point of insanity. 回答1: If you're using JSF

Difference between View and Request scope in managed beans

我怕爱的太早我们不能终老 提交于 2019-12-17 01:43:48
问题 What does the view scope mean? Can anyone explain about it, so that I can understand how it differs from the request scope? 回答1: A @ViewScoped bean lives exactly as long as a JSF view. It usually starts with a fresh new GET request, or with a navigation action, and will then live as long as the enduser submits any POST form in the view to an action method which returns null or void (and thus navigates back to the same view). Once you refresh the page, or return a non- null string (even an