facelets

What is the difference between JSF and Facelets?

♀尐吖头ヾ 提交于 2019-12-03 06:42:36
问题 I am following the Java EE6 tutorials and I don't understand the difference between JSF and Facelets. Chapter 4 goes has a section 'Developing a Simple JavaServerFaces Application' and Chapter 5 has a section 'Developing a simple Facelets' application and as far as I can see both these examples use the exact same process - an .xhmtl page for the markup, a backing bean to hold some data and then a web.xml file that maps urls to the 'FaceletsServlet'. From what I can gather Facelets are .xhtml

Should I use Facelets “jsfc” attribute?

老子叫甜甜 提交于 2019-12-03 04:46:36
问题 Facelets uses the jsfc attribute to convert HTML elements to their associated JSF components. This is rather helpful for fast prototyping as it allows you to create your views using a visual design tool. However I recently discovered this blog post by Cay Horstmann where he lays waste to the use of jsfc together with complex components such as h:dataTable . This alarmed me as Cay Horstmann is the author of multiple of my favorite Java books. However my Google-fu skills have yielded zero

File upload using RichFaces

偶尔善良 提交于 2019-12-03 03:09:17
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.getUploadItem(); File f = item.getFile(); System.out.println(f.getAbsolutePath()); } The Absolute path

How to repeat output of text via simple for loop in Facelets without model?

天涯浪子 提交于 2019-12-03 02:23:43
问题 How to repeat output of some content in JSF using only standard tags (ui:, h: etc) ? In other words - how to do equivalent to PHP code below in JSF ? I immediately wanted to take advantage of ui:repeat , but it needs collection - I have only number. for ($i = 0; $i < 10; $i++) { echo "<div>content</div>"; } 回答1: Either use <c:forEach> instead (true, mixing JSTL with JSF is sometimes frowned upon, but this should not harm in your particular case because you seem to want to create the view

How to use && in EL boolean expressions in Facelets?

佐手、 提交于 2019-12-03 02:07:48
问题 I am having a little trouble figuring out how to do and's on EL expressions in Facelets. So basically I have: <h:outputText id="Prompt" value="Fobar" rendered="#{beanA.prompt == true && beanB.currentBase !=null}" /> But I keep getting: Error Traced[line: 69] The entity name must immediately follow the '&' in the entity reference. 回答1: Facelets is a XML based view technology. The & is a special character in XML representing the start of an entity like & which ends with the ; character. You'd

How to save an array in JSF with ui:repeat + h:inputText + managed bean?

我与影子孤独终老i 提交于 2019-12-03 00:51:34
In a postgres database I have a table with, among others, an int[] field. In my model I have a persisted bean that maps the table, including the int[] field. In this class I have implemented all the needed setters/getters. Now, I have a managed bean which plays also the controller role, and links to the model bean. So, in my xhtml I'm trying to do this: <ui:repeat value="#{drawsetController.selected.editableBaseSetList}" var="baseNumber"> <h:inputText value="#{baseNumber}"/> </ui:repeat> baseSetList is the int[] array. The problem is that when I submit my form only this element is not updated.

Passing action method names as arguments to facelets componenets

和自甴很熟 提交于 2019-12-02 19:16: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 target="#{itemToEdit}" value="#{item}"/> </h:commandLink> </td> <tr> </ui:repeat> which works fine. I now

Should I use Facelets “jsfc” attribute?

浪尽此生 提交于 2019-12-02 19:06:05
Facelets uses the jsfc attribute to convert HTML elements to their associated JSF components. This is rather helpful for fast prototyping as it allows you to create your views using a visual design tool. However I recently discovered this blog post by Cay Horstmann where he lays waste to the use of jsfc together with complex components such as h:dataTable . This alarmed me as Cay Horstmann is the author of multiple of my favorite Java books. However my Google-fu skills have yielded zero results when trying to determine the scope/nature of the problem, other than a recent post by Ed Burns , who

How to avoid repetitions / use constants in Facelets page?

一个人想着一个人 提交于 2019-12-02 18:52:05
问题 In a Facelets page, I have various <h:inputText> and <h:outputText> components, which all need the same converter. I'd like to avoid repeating the converter with all its parameters, like this: <h:inputText id="bla" value="#{mybean.val}" > <f:convertNumber locale="en" maxFractionDigits="3" minFractionDigits="3"/> </h:inputText> [...] <h:outputText id="bla2" value="#{mybean.val2}" > <f:convertNumber locale="en" maxFractionDigits="3" minFractionDigits="3"/> </h:outputText> [...] <h:inputText id=

Reading bean list using jstl and assigning to javascript variable in facelets

一世执手 提交于 2019-12-02 17:28:13
问题 I am using facelet and draw function has jstl tag: <ui:define name="content" > <h:outputScript name="js/graphics/paths.js"/> <h:outputScript name="js/graphics/draw.js"/> Tag to be evaluated when function is called(is that possible)? function showMap(){ var data = { <c:forEach items="${list.KPI}" var="ctag" varStatus="loop"> '${ctag.USTER}': ${ctag.Value} ${!loop.last ? ',' : ''} </c:forEach> } } Error: Is it possible to use jstl with facelets? Why am i getting this error? I am using there