jsf-2

Javascript and <p:ajax> behave strange

北战南征 提交于 2019-12-11 19:04:36
问题 I have a js-function codeAddress() that processess the data from address and updates the values of fullAddress and validField . The data of fullAddress and validField is passed by <p:ajax> to the backing bean, but the setter methods seem to get called one request delayed. The alert() at the end of codeAddress shows the correct new data. When address has onchange="test()" everything works fine an the backing beans setter methods are called as they should without any delay. I am clueless what

HTML doctype declaration in JSF

Deadly 提交于 2019-12-11 18:53:44
问题 I have a very strange problem in JSF page that I cannot solve. I have this html doctype declaration into the xhtml page: <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">

Composite Component with child- Composite Component: Not thread safe?

荒凉一梦 提交于 2019-12-11 18:52:09
问题 Does anybody know if passing objects as parameter from one composite component to another child composite component is thread-save? I have a composite component A that uses another composite component A' as child and passes an object as parameter cc.attrs.parameter to A'. A is used twice in the same form: Component A: <cc:interface> <cc:attribute name="value"/> </cc:interface> <cc:implementation> <cdef:myChildComponent value="${cc.attrs.value}"/> <!-- Show data from value --> </cc

JSF Passing Bean to View Failing

独自空忆成欢 提交于 2019-12-11 18:49:12
问题 I am trying to write a simple JSF page that initially includes two subviews/includes, and pass the backing bean to one of the includes because the include is meant to be reusable (and possibly included more than once in a larger application). This is the relevant code: page1.xhtml <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:p="http://xmlns.jcp.org/jsf/passthrough" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org

Cross Field Custom constraint annotation not working

南楼画角 提交于 2019-12-11 18:48:03
问题 i have a dropdown field named ContactTypeName which have the values like phone, email etc and an input field named Contact i want to validate the input field for valid email address if the dropdown value Email is selected... i have the following bean @FieldMatch.List({ @FieldMatch(first = "contactDetail", second = "contectTypeName", message = "Please Enter a valid email address") }) public class Contact { private int contactId = 0; @NotNull(message="Please Select a Contact Type") private

JSF2 slow page loading

◇◆丶佛笑我妖孽 提交于 2019-12-11 18:43:23
问题 I'm working with a JSF2 webapp. When I'm navigating between different pages they normally load fast; less than 100 ms. Sometimes though, for no apparent reason, it takes several seconds. I've been trying to find some common denominator for when this occurs, but it happens regardless of page and regardless if I have visited the page several times before. Also, after a page has been slow to load, the next time I load it, it will load fast again for some time. It all seems to happen randomly. I

Cancel button doesn't work in case of validation error

[亡魂溺海] 提交于 2019-12-11 18:23:48
问题 i have a form with some inputs that have validation (required=true) and when i click on the cancel button in case of validation error, the cancel button doesn't navigate to previous page, instead it removes the validation error (i think it goes back one step that was before the validation error ?) here's my code: <h:form> <h:inputText value="#{myBean.nickName}" id="nickname" required="true" requiredMessage="nickname should be specified" /> <h:commandLink immediate="true" id="cancel_link"

JSF/Bean #{} not rendered/parsed

≯℡__Kan透↙ 提交于 2019-12-11 18:23:21
问题 i have a problem with rendering #{} inside JSF page. I'm using Mojarra 2.1.5 and JBoss 7 Example: JSF Page <h:inputText value="#{bean.name}"/> faces-config.xml <managed-bean> <managed-bean-name>bean</managed-bean-name> <managed-bean-class>com.Bean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> HTML Output #{bean.name} Question Why i don't see proper values from bean ? Why i'm getting string instead of nothing ? UPDATED web.xml content: <?xml version="1.0

Hide Empty Datatable PrimeFaces

谁说胖子不能爱 提交于 2019-12-11 18:07:48
问题 I work on glassfish 3.1 with Primefaces. And i need to hide a dataTable if she is empty for display a error message. But i can't hide a DataTable in the view. Anyone can give me an exemple for help me ? Thanks 回答1: You can use style attribute: style="display:block;" when data found or: style= "display:none"; when data not found. You can also use renderen attribute: <p:dataTable rendered="#{bean.dataFound}" 来源: https://stackoverflow.com/questions/11864652/hide-empty-datatable-primefaces

proof of concept for multiple clients in JSF 2.0

让人想犯罪 __ 提交于 2019-12-11 17:57:34
问题 I have to implement a Proof of concept for multi client handling in JSF 2.0. How can multiple clients be handled in jsf? 回答1: Just do not store request or session scoped data in a managed bean which is placed in the application scope. Also just do not declare the properties of a request or session scoped bean which is supposed to live as long as the bean itself as static . It's under the hoods not different from the basic Servlet API. 回答2: JSF 2.0 helps you to provide a way to create user