jsf-2

How to make composite component similar to <h:selectOneRadio />

匆匆过客 提交于 2020-02-03 11:37:27
问题 I have been searching a lot for a way to make a composite component similar to: <h:selectOneRadio /> but I did not succeed. I want something like: <myowntags:selectOneRadio> <f:selectItem itemValue="value0" itemLabel="This is the value 0" /> <f:selectItem itemValue="value1" itemLabel="This is the value 1" /> <f:selectItem itemValue="value2" itemLabel="This is the value 2" /> </myowntags:selectOneRadio> and: <myowntags:selectOneRadio> <f:selectItems value="#{controller.items}" /> </myowntags

JSF 2 navigation always from root folder

拈花ヽ惹草 提交于 2020-02-02 15:59:30
问题 I have a JSF 2 application with the following xhtml structure: --webapp --index.xhtml --folder1 --targetPage.xhtml --folder2 --otherPage.xhtml I have a managed bean called TargetPageBean with the following method: public String navigateToTargetPage() { if( isOnIndexPage() ) { return "folder1/targetPage.xhtml?faces-redirect=true"; } else { return "targetPage.xhtml?faces-redirect=true"; } } This would work fine in these two cases: I navigate just from the index page to the target page I am

Insert new line in a backing bean string value

孤人 提交于 2020-02-02 10:06:50
问题 How to insert a new line between words for a backing bean value and display it on UI using JSF 2.0 framework? If we have address. The street name should be in first line and city and state should be in the second line. I am using a converter to add new line. But it does not show up on the UI. 回答1: JSF is basically a HTML code generator. A new line is in HTML to be presented by the <br /> tag, not by \r\n characters or something. You can just do it straight in the view instead of mingling view

Nesting variables in EL

送分小仙女□ 提交于 2020-01-28 11:23:09
问题 Is it possible to nest variable calls like below in EL using FacesContext or other implicit objects like request , session , etc.? This of course is not working. I get this error Error Parsing: #{myBean.myMethod(#{FacesContext.getCurrentInstance().getViewRoot().getViewId() })} for this attempt <ui:include src="#{myBean.myMethod(#{FacesContext.getCurrentInstance().getViewRoot().getViewId() })}"> 回答1: This is indeed invalid EL syntax. Nesting of #{} is disallowed. Just put the whole expression

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="#

Setting a validator attribute using EL based on ui:repeat var

China☆狼群 提交于 2020-01-28 01:55:24
问题 I am looking for a little bit of guidance today with the issue I am running into. What I am trying to accomplish is build a page on the fly with validation and all. The end result is to allow the user to configure the fields on the page through administrative functions. Below is a copy of the code that I am using as the test page where I loop through the "Configured" fields and write out the fields using the defined criteria. <ui:repeat var="field" value="#{eventMgmt.eventFields}" varStatus=

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