jsf

Dynamically add the component in JSF?

好久不见. 提交于 2020-01-30 11:41:04
问题 In my application the component has to change dynamically. I am having a Datatable in that i am having two column, first is a <h:selectoneMenu> in the menu i am having two data(the data are 1 and 2) if 1 is selected then a <h:inputText> should appear and if 2 is selected <h:selectoneMenu> should appear. Need help to do this? My JSF <h:selectOneMenu id="menu" value="#{sample.data}" rendered="true" valueChangeListener="#{sample.change}"> <f:selectItem itemLabel="Data" itemValue=""/> <f

Passing string parameter to a function or method from xhtml

放肆的年华 提交于 2020-01-30 05:26:11
问题 I have a button that I'd like to render based on whether a function returns true or false. The HTML: <p:commandButton type="button" rendered="#{myBean.checkPermission(1)}" value="Create" /> And the supporting bean: public boolean checkPermission(String actionKey) { ... } The problem is that when I call checkPermission with a numeric parameter like #{myBean.checkPermission(1)} , it works fine, but with I pass a String as a parameter, i.e. #{myBean.checkPermission(ABC)} , I get an empty string

jsf login times out

青春壹個敷衍的年華 提交于 2020-01-29 08:43:25
问题 Ok simple question. I have a JSF application, containing a login page. The problem is if the user loads the login page, leaves it for a while, then tries to login the session expires and a ViewExpiredException is thrown. I could redirect back to the login when this happens, but that isn't very smooth. How can I allow this flow to properly login without an additional attempt? 回答1: Update As of Mojarra 2.1.19 / 2.2.0 you can now set the transient attribute of the <f:view> to true: <f:view

JSF-generated HTML element ID is changing, how to set it to a fixed element ID?

烂漫一生 提交于 2020-01-29 07:14:24
问题 I have a JSF input text component which has an id of search . In the generated HTML output it looks like this j_idt17:search , but the number 17 is changing from time to time. How to make it to stay one? 回答1: Give the JSF component which generated the HTML element with id="j_idt17" a fixed ID. In this particular case, it's likely the HTML input element's parent <form> element which is generated by the JSF <h:form> component. So, this should do: <h:form id="form"> This way the ID of the

JSF-generated HTML element ID is changing, how to set it to a fixed element ID?

社会主义新天地 提交于 2020-01-29 07:13:13
问题 I have a JSF input text component which has an id of search . In the generated HTML output it looks like this j_idt17:search , but the number 17 is changing from time to time. How to make it to stay one? 回答1: Give the JSF component which generated the HTML element with id="j_idt17" a fixed ID. In this particular case, it's likely the HTML input element's parent <form> element which is generated by the JSF <h:form> component. So, this should do: <h:form id="form"> This way the ID of the

Why is my p:progressBar not displayed, only the number?

こ雲淡風輕ζ 提交于 2020-01-28 11:05:22
问题 I have following XHTML file with a progress bar: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" xmlns:pm="http://primefaces.org/mobile"> <f:view renderKitId="PRIMEFACES_MOBILE"/> <h:head></h:head> <f:event listener="#{mainOp.init}" type="preRenderView" /> <h:body id="body"> <pm:page id="page"> <pm:header title="MyProduct"> </pm:header> <pm:content id="content"> <p

<my:foo> Tag Library supports namespace: http://java.sun.com/jsf/composite/mycomponents, but no tag was defined for name: foo

怎甘沉沦 提交于 2020-01-28 08:04:18
问题 I have a composite component named <my:foo> and I'm building another composite component named <my:bar> . But when I attempt to use <my:foo> inside the <cc:implementation> of <my:bar> , the following exception is been thrown: <my:foo> Tag Library supports namespace: http://java.sun.com/jsf/composite/mycomponents, but no tag was defined for name: foo How is this caused and how can I solve it? 回答1: This is caused by a bug which was introduced in Mojarra 2.1.8, continued in 2.1.9 and is fixed in

p:commandLink fails to open page in new window/tab

扶醉桌前 提交于 2020-01-28 06:21:28
问题 I'm trying to create a link to open a new page in a different window/tab and display some msg from backing bean but fail to do it, wonder know why? here is my xhtml file: <html:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:body> <h:form id="form66"> <p:commandLink actionListener="#

Skip required validation and invoke the application

无人久伴 提交于 2020-01-27 04:27:24
问题 I asked my question here but I think it lacks some obvious information. Hence I'm posting my question again. I have a JSF form which has some required validation on h:inputText fields. When submitting the form I want to skip(or ignore) the required validation check and still invoke the application. I do want to do the form data validation and show the errors based on some condition. Basically I want to skip the validations and invoke the application when the form is submitted using an ajax

Need tutorial on implementing a JSF ResourceHandler

社会主义新天地 提交于 2020-01-26 04:07:28
问题 My application needs to implement dynamic images, where a browse can get served a JPG or PNG out of my data base. I have been reading this thread and am not getting very far in learning from it. Can someone provide a link to a tutorial about how to implement a ResourceHandler. Having looked through all the books Amazon offers on JSF 2.0, none of them seem to cover this topic. Thanks in advance. UPDATE: This question is withdrawn since I took a different path to the solution, which was simply