facelets

f:ajax doesn't work when parameters are passed using f:param

﹥>﹥吖頭↗ 提交于 2019-12-03 21:49:39
I am calling a method on the click of link. The following code works ajaxfully <ui:repeat value="#{myBean.names}" var="name" varStatus="idx"> <li> <h:commandLink value="#{name.label}"> <f:ajax execute="@this" event="click" render="@all" listener="#{myBean.changeActiveName}" > </f:ajax> </h:commandLink> </li> </ui:repeat> But when I try to pass parameter to the Ajax call it starts refreshing the whole page <ui:repeat value="#{myBean.names}" var="name" varStatus="idx"> <li> <h:commandLink value="#{name.label}"> <f:ajax execute="@this" event="click" render="@all" listener="#{myBean

JSF - Another question on Lifecycle

瘦欲@ 提交于 2019-12-03 21:41:49
Today I'd like to know some features on the JSF Lifecycle. Let me start : 1 - Phase 2:Apply request Values - During this phase,each component in the view will search for its values in the request and set the new values to them Uhm, ok nice. So, the View will be built due to the previous Beans parameters. After, there is a partial View, generated with the request values. (Right? Later, in the 3° phase, they will be compared) . But, for example, if a values in the request list is absent during the creation of this last view? Values will be null? 2 - Phase 5: Invoke Application - Once all the

Xhtml pages and HttpSession test , no jstl?

蓝咒 提交于 2019-12-03 21:38:37
I have a dynamic web application in Java EE with JSF, Facelets, Richfaces. My pages are all xhtml pages. So JSTL isn't working in it. For my account pages and all other private pages to be reachable, I want to test if the user got connected, so if the attribute session in HttpSession is not null. If it's null, the user gets redirected in the welcome page. I tried in my xhtml page : <jstl:if test="${sessionScope['session']==null}"> <jstl redirect...> </jstl:if>--> but as it's not jsp page it won't work. So where am I supposed to test if the session is not null to allow the user to see his

Hide .xhtml source - facelets/icefaces?

我是研究僧i 提交于 2019-12-03 16:53:22
I'm new to Icefaces and Facelets both, but I'm using them on a new project. I've got everything working configured and working fine. However, when I visit mywebapp/file.xhtml, the entire facelets template source comes up in my browser. How could I hide this to prevent users from viewing my server-side templates? Put all templates into WEB-INF/someDirectory/templates. Then according to the facelets documentation put this inside your web.xml for all other xhtml files: <security-constraint> <display-name>Restrict XHTML Documents</display-name> <web-resource-collection> <web-resource-name>XHTML<

How to reference Facelets taglib in JAR from Facelets and web.xml?

落花浮王杯 提交于 2019-12-03 14:36:18
I am using the Apache MyFaces Commons Validator TagLib. How should i add this to my web.xml? The commons JAR is downloaded and resolved through Maven. XHTML (I think this is correct): <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.prime.com.tr/ui" **xmlns:mcv="http://myfaces.apache.org/commons/validators"**> web.xml: <context-param> <!-- To add additional tab libs --> <param-name>facelets.LIBRARIES</param-name> <param-value>??.xml</param-value> </context-param> EDIT : The reason why i got to

How to conditionally include a file in my template using JSF and Facelets?

社会主义新天地 提交于 2019-12-03 14:17:06
So, my template includes a footer.xhtml <ui:include src="/WEB-INF/testtaker/Footer.xhtml"/> What I want to do is change the footer based on some users pref to different Footer_???.xhtml file. So, I'd like to do something like this: <ui:include src="/WEB-INF/testtaker/Footer_001.xhtml"> Content from original Footer.xhtml </ui:include> and if Footer_001.xhtml doesn't exist, then let it use the content between the tags, otherwise use the content from the file. I know this seems a little odd, but this will solve a huge problem of customizing my existing site with out having to make changes to

File upload using RichFaces

巧了我就是萌 提交于 2019-12-03 13:58:46
问题 I am currently looking in to some file uploading using Java Server Faces. I've found this great introduction to it using RichFaces. However, I have some troubles understanding the process here. First the user selects a file and if the immediate upload is set to true the file is processed using ajax, so far so good. When it comes to the next step however, the listener on the Bean-side the following confuses me: public void listener(UploadEvent event) throws Exception{ UploadItem item = event

PrimeFaces DataTable CellEdit get entity/object

ぐ巨炮叔叔 提交于 2019-12-03 12:44:15
I have a datatable which displays various entities based on a List<>. When I select a cell for editing I want to be able to also get the entity somehow in order to update it. Of course there is event.getRowIndex, which I can then use with the List<>, but that is not always convenient. Is there perhaps another way to get the entity from CellEditEvent? One way would be to programmatically EL-evaluate the current <p:dataTable var> . Given a <p:dataTable value="#{bean.entities}" var="entity"> you could get it as follows public void onCellEdit(CellEditEvent event) { FacesContext context =

How to create a reuseable template with header/footer/navigation?

放肆的年华 提交于 2019-12-03 07:58:17
I have been playing with JSF and have a project working that has a header/footer/navigation/content panels. The project, however, goes from page 1 to page 2, etc., with each page having a different layout. How can I create a reusable template that keeps the same look and feel from page to page, i.e., header/footer/navigation stay the same, but content is updated? This sounds like a classic case of a master template. In such a template you put everything that's common to all pages and then your actual pages reference this template and "fill in the blanks". In a way it's the reverse of the also

Passing action method names as arguments to facelets componenets

十年热恋 提交于 2019-12-03 06:44:31
问题 I am calling a template and am passing in parameters like below: <ui:include src="WEB-INF/Subviews/ProductEdit.xhtml"> <ui:param name="items" value="#{produtList}"></ui:param> <ui:param name="itemToEdit" value="#{productToEdit}"></ui:param> </ui:include> and in the ProductEdit.xhtml, I have something like <ui:repeat value="#{items}" var="item"> <tr> ... ... <td style="text-align: center"> <h:commandLink style="cssGenericColumn" action="#{productEditAction}"> <f:setPropertyActionListener