facelets

javax.faces.view.facelets.FaceletException: Error Parsing /my.xhtml: Error Traced[line: 42] The prefix “f” for element “f:facet” is not bound

岁酱吖の 提交于 2019-11-28 02:02:10
I would like to create table which can display data from database into JSF page. I found this code: <h:dataTable value="#{bookStore.items}" var="store"> <h:column> <f:facet name="header"> <h:outputText value="#{msg.storeNameLabel}"/> </f:facet> <h:outputText value="#{store.name}"/> </h:column> <h:column> <f:facet name="header"> Subject </f:facet> <h:outputText value="#{store.subject}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="#{msg.storePriceLabel}"/> </f:facet> <h:outputText value="#{store.price}"/> </h:column> </h:dataTable> When I use this code I get this error

Creating an “Edit my Item”-page in Java Server Faces with Facelets

你离开我真会死。 提交于 2019-11-28 01:38:58
问题 Let's say that you have the following Facelet ( Using Facelets 1.1.12 ): edit_item.xhtml which i access with edit_item.jsf Now i have another page sending me to edit_item.jsf with the GET-paremeter ID the uri looks like this: http://mysite.com/edit_item.jsf?ID=200 How do you access a Bean and fetch the Information, and display this on the requesting page with JSF and Facelets? Is there a way to run a bean when a page loads? 回答1: You can use the faces-config.xml configuration to inject the ID

<h:outputScript> target problem when using templates

浪子不回头ぞ 提交于 2019-11-28 01:12:26
问题 I have a question about integrating jquery library with JSF 2.0 when using <h:outputScript library="/common/js" name="jquery-1.5.1.min.js" target="head" /> , i should include <h:head> tag also in my xhtml file. so script is rendered at head. but i have a template.xhtml that contains <h:head>,<h:body> parts. How can i make target="head" /> for my page that derives from this template ui:composition="template.xhtml" ? target=form> didn't work either. my template: <?xml version='1.0' encoding=

How to escape '$' and '#' in Facelets/EL?

ε祈祈猫儿з 提交于 2019-11-28 00:57:52
问题 I'm using Java Facelets and jQuery, however the expression $('...') in jQuery conflicts with EL expression, how do I escape the jQuery's one? I'd like to escape a large chunk of Javascript, too. ANSWERED To convert the existing JSP to Facelets xhtml, it's convenient to just wrap the existing javascript by <![CDATA[ ... ]]> . However, the output scripts for <script> are wrapped by <!-- --> comment, which conflicts with CDATA section: <script><![CDATA[ scripts... ]]></script> => <script><!-- <!

How to refactor snippet of old JSP to some JSF equivalent?

*爱你&永不变心* 提交于 2019-11-28 00:35:33
问题 ORIGINAL JSP (WorkItem.jsp) <c:forEach var="actionItem" items="${workItem.work_action_list}"> <c:if test="${actionItem.workActionClass.work_action_type_id == '1'}" > <%@ include file="inc_done_button.jsp" %> </c:if> <c:if test="${actionItem.workActionClass.work_action_type_id == '2'}" > <c:set var="actionItem" value="${actionItem}" scope="request" /> <c:set var="checklist" value="${actionItem.meat}" scope="request" /> <jsp:include page="inc_dynamic_checklist_v.jsp" flush="true" /> </c:if> etc

How to change css class for the inputfield and label when validation fails?

久未见 提交于 2019-11-28 00:34:35
Suppose I have a username to validate, in this case I need to show username outputText and username inputText field in red color when validation fails along with error message. I tried to bind all these in a panelgroup so that if validation fails all field should be affected. But simply putting panelgroup is not working. My backing bean validator public void emailValidate(FacesContext context, UIComponent componentToValidate, Object value) throws ValidatorException { String email = value.toString(); if (!Validator.isEmailAddress(email)) { FacesMessage message = new FacesMessage(FacesMessage

JSF ui:include not being rendered properly

笑着哭i 提交于 2019-11-27 22:48:49
问题 I'm implementing a web application using JSF 2.1.8 and I have a problem with the ui:include tag. I have this code <h:panelGroup id="panelContenido"> <ui:fragment rendered="#{!empty navigationManagerSystem._Navegable}"> <ui:include src="#{navigationManagerSystem._Navegable._IncludePath}" /> </ui:fragment> <ui:fragment rendered="#{empty navigationManagerSystem._Navegable}"> <ui:include src="/system/navigation/error.xhtml" /> </ui:fragment> </h:panelGroup> The navigationManagerSystem bean is JSF

JSTL c:forEach causes @ViewScoped bean to invoke @PostConstruct on every request

℡╲_俬逩灬. 提交于 2019-11-27 22:27:12
Again i see that the @PostConstruct is firing every time even though no binding attribute is used. See this code :- <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core"> <h:head> <title>Facelet Title</title> </h:head> <h:body> <h:form> <c:forEach var="item" items="#{TestBean.listItems}"> <h:outputText value="#{item}"/>

JSF Facelets how to include external html?

烈酒焚心 提交于 2019-11-27 22:24:16
问题 I have an app that i'm developing and my company has a header banner that is required to be on all pages. We have about 6 different versions floating around my team of that header banner and I now want to make it so that I just include the banner from the source into my app so that if they update the source of the banner, my app's version of the banner is automatically updated as well. using <ui:include src="http://mycompany.com/banner.html" /> causes the error The markup in the document

ui:repeat and h:panelGrid

跟風遠走 提交于 2019-11-27 22:18:44
When using something like <h:panelGrid columns="1"> <ui:repeat var="o" value="#{mybean.list}"> <h:outputText value="#{o.text}"/> </ui:repeat> </h:panelGrid> with lets say 10 list entries I only get 1 row e.g.: one tr with 1 td whereas when I use c:forEach i get 10 (but c:forEach is in fact evil, it messes up everything with ajax) I use mojarra 1.2 - is this a typical Mojarra bug which does not exist in the MyFaces implementation? Will it disappear in 2.x of the Mojarra releases? BalusC The output is fully as expected and specified. The <ui:repeat> is a render time tag, not a view build time