jsf-2

How do I set Managed Bean field to the value of a ui:param?

拥有回忆 提交于 2019-12-20 03:43:29
问题 I have a JSF page that is included in other JSF pages (basically a page header, with common information). This common page has its own controller and is reliant that the page which includes this common page pass it some common data. Specifically, I am currently trying to include this common page on other pages using: <ui:include src="commonPage.xhtml"> <ui:param name="commonData" value="#{thisPagesController.commonData}"/> </ui:include> Which should pass "commonData" to the commonPage.xhtml

Unable to get servletcontext path in jsf

一个人想着一个人 提交于 2019-12-20 03:29:09
问题 I have written a liferay richfaces portlet. But iam not able to get the css path or images in the web-inf folder. My portlet config is <portlet> <portlet-name>testLR6_PB3_RF4</portlet-name> <instanceable>true</instanceable> <render-weight>1</render-weight> <ajaxable>true</ajaxable> <header-portlet-css>/resources/css/style.css</header-portlet-css> <header-portlet-javascript>/js/eims.js</header-portlet-javascript> <footer-portlet-javascript>/js/fileupload.js</footer-portlet-javascript> <

How to get ID of calling component in the getter method?

为君一笑 提交于 2019-12-20 03:19:17
问题 Given the following example: <h:inputText id="foo" size="#{configBean.size}" /> I would like to get the id of the calling component foo in the getter method so that I can return the size from a properties file by a key of foo.length . public int getSize() { String componentId = "foo"; // Hardcoded, but I should be able to get the id somehow int size = variableConfig.getSizeFor(componentId); return size; } How can I achieve this? 回答1: Since JSF 2.0, there's a new implicit EL variable in the

How to open a page in a new tab but don't give it focus?(JSF 2.0)

[亡魂溺海] 提交于 2019-12-20 03:17:34
问题 What i want is to open a page in a new tab but don't give focus to the new opened tab. So if i click a few times i can open a few tabs. Just as if i right clicked a link and said open in new tab(I tried that only in chrome and firefox browsers). Do you know is it possible? Currently i open new tabs using a form with a button that looks like this: <h:form target="_blank"> <h:commandButton action="#{mainPageBB.toLink}"/> </h:form> 回答1: As with many other things which changes the client default

OmniFaces o:validateAllOrNone in ui:repeat or h:dataTable

怎甘沉沦 提交于 2019-12-20 03:17:16
问题 Is it possible to use OmniFaces <o:validateAllOrNone> (which is pretty cool ;)) within an <ui:repeat> or <h:dataTable> ? I need a table with each row having an input field column. You could either fill in none of these values or all of them. If I put the <o:validateAllOrNone> within the <ui:repeat> or <h:dataTable> and use the id of the input field in components attribute, then the validator also gets triggered, if all fields are empty. 回答1: No, that's not possible. The components attribute

Bold second item of a selectOneMenu

对着背影说爱祢 提交于 2019-12-20 02:59:22
问题 I've got a selectOneMenu which has all cities of a state. I've made a sql to bring capital in first place, but i'd like to bold it to make it more visible to who is using it. Is there a way to bold it or to do something else to make more visible just the second option? <h:selectOneMenu value="#{someBean.cityId}"> <f:selectItems value="#{addressBean.stateList}" /> </h:selectOneMenu> 回答1: The HTML <option> element as generated by <f:selectItems> allows for very little fine-grained styling and

Is there something like <c:url> for JSF?

亡梦爱人 提交于 2019-12-20 02:53:02
问题 Is there a taglib in JSF for inserting the proper application context root in any URL I want, just like the <c:url> tag in JSP does? 回答1: Not exactly that, but all JSF components which refer to an URL resource will already automatically include the proper context path and eventually also the FacesServlet mapping. For example the <h:link>: <h:link value="Link to other page" outcome="otherpage" /> which renders something like (assuming that your context path is /contextname and your

How does JSF process action listener?

牧云@^-^@ 提交于 2019-12-20 02:45:19
问题 I'm curious how JSF know that I click the button, with some action and it is even possible to call an action listener with a parameter. I can imagine the server notice the state and EL and call the methods. Example 1: <form> <p:commandButton actionListener="{bean.do_something(bean.info)}" /> </form> Example 2: <form> <h:datatable values=... var="myvar"> <h:column> <p:commandButton actionListener="{bean.do_something(myvar.info)}" /> </h:column> </h:datatable> </form> 回答1: During the apply

How to change setRowCount of lazyloading of p:datatable dynamically

爷,独闯天下 提交于 2019-12-20 02:45:18
问题 I have a situation where the pagination should be dynamically. Meaning that it should change with each call of the load method. I want set the setRowCount() method dynamically and give the pagination for the dataTable @Override public List<ProjectMasterModel> load(int first,int pageSize,StringsortField, SortOrder sortOrder, Map<String, String> filters) { List<ProjectMasterModel> data=new ArrayList<ProjectMasterModel>(); LazyDataModel<ProjectMasterModel> newdata = null; ProjectMilestoneDaoImpl

Primefaces datatable filtering not working [duplicate]

依然范特西╮ 提交于 2019-12-20 02:42:26
问题 This question already has an answer here : java.lang.NullPointerException at org.primefaces.component.datatable.feature.FilterFeature.filter (1 answer) Closed 3 years ago . I'm trying to make a table filter using Primefaces 5, but the filtering dosn't occur and get the follow stack: java.lang.NullPointerException at org.primefaces.component.datatable.feature.FilterFeature.filter(FilterFeature.java:136) at org.primefaces.component.datatable.feature.FilterFeature.encode(FilterFeature.java:105)