facelets

Untraceable errors in XHTML templates caused by a missing space between attributes among (X)HTML tags

笑着哭i 提交于 2019-11-29 18:10:52
Have a simple question. Let's consider the following tag. <h:inputText id="text" value="#{bean.value}"/> If it is mistakenly written as follows. <h:inputText id="text"value="#{bean.value}"/> Please notice that there is no space between the id and the value attributes in this case. This is expected to be a parse error that should occur during parsing of the XHTML file possibly throwing an appropriate exception. If it were to happen, absolutely nothing exceptional would be reported. No errors/exceptions would be thrown on the server-side. The target web page on the browser would then merely be

Does Facelets rebuild the whole page if Ajax is trigger from a form and updates another?

馋奶兔 提交于 2019-11-29 18:05:22
Setup: I have 2 forms A & B I have a commandLink in form A: <h:commandLink actionListener="#{homeView.selectDiv('homeUpdates')}">#{msg.homeUpdates} <f:ajax render=":B" execute="@this" /> </h:commandLink> ...which updates form B. The problem is that when I click the ajax link, it rebuilds form A as well and gets an exception from a ui:repeat I have. Is this correct behaviour? Should it rebuild form A as well? I am using JSF 2.2 and form A contains a ui:fragment=>ui:include=>ui:repeat =====Added SSCCE======= The following code does not run after pressing Update B! twice. It gives an exception of

web.xml setup for facelets template and client

喜夏-厌秋 提交于 2019-11-29 17:36:17
I've looked at a few resources for JSF and facelets, but don't understand a few configuration points. What's the distinction between: <url-pattern>/faces/*</url-pattern> and: <url-pattern>*.jsf</url-pattern> While I understand it's possible to have several url-pattern elements, unless .jsf pages are explicitly being used, there's no actual need for this mapping, correct? If only faces templates and clients are being used, then it's extraneous? Furthermore, if the facelet template and client are inside WEB-INF , how are they accessed? With the latest releases for JSF and Facelets, there seems

How to include file from external local disk file system folder in JSF

一世执手 提交于 2019-11-29 17:05:27
I have included a JSP page into Facelets using <ui:include> . In JSP page I am able to get the PDF, but it displays content as plain text. How is this caused and how can I solve it? JSP page: <html> <%@page import="java.io.File"%> <%@page import="java.io.*"%> <body> <% response.reset(); File file = new File( "D:\\TNWRD_Documents\\Knowladge_Base\\Financial_and_Administrative_powers.pdf"); response.setHeader("Content-Type", "application/pdf"); response.setHeader("Content-Disposition","inline;filename=Saba_PhBill.pdf"); response.setContentLength((int)file.length()); //OPen an input stream to the

JSF error - IllegalStateException: PWC3999: Cannot create a session after the response has been committed [duplicate]

喜夏-厌秋 提交于 2019-11-29 16:29:36
问题 This question already has an answer here: Adding <h:form> causes java.lang.IllegalStateException: Cannot create a session after the response has been committed 5 answers I am new to JSF and I am building a application created with facelets. Here is my template master.xhtml <body id="body"> <form id="frmmaster"> <div id="pg-nav-bg"> <div class="wrapper clear"> <div class="footer clear"> <div class="footerContent">Help Des</div> </div> <div id="pg-nav"> <ul class="nav sf-js-enabled"> <li class=

How to iterate a HashMap with primefaces selectable datatable

大城市里の小女人 提交于 2019-11-29 15:44:39
I have tried different solutions but none is working in my case. I want all the rows in this datatable to be selectable. The problem seems to be the <ui:repeat that is probably overriding the objects... My bean: @ManagedBean @ViewScoped public class Chat { private static Map<String, List<ChatObject>> chat = new LinkedHashMap<String, List<ChatObject>>(); private ChatObject selectedChatObject; public void onChatRowSelection(){ if(getSelectedChatObject() != null){ System.out.println("test"); } } public List<Map.Entry<String, List<ChatObject>>> getChatList() { Set<Map.Entry<String, List<ChatObject

Dynamically added input field in ui:repeat is not processed during form submit

别来无恙 提交于 2019-11-29 15:37:30
I am trying to make a input form for answers in my application and I start with four "empty" answers which the view loops over and make input fields for. I have an add answer button which I add one question to the array of answers and then the view render the answers again, but now with an additional input field. The backing bean is viewscoped. However if I submit the form without pressing the add answer button it all works. The data is saved in the database. But if I add an answer after the four is filled out the last one does not get the data from the inputfield (answer.description). If I

Custom FaceletFactory in JSF 2.2 / Alternatives for virtual host facelets

扶醉桌前 提交于 2019-11-29 15:20:41
Since Mojarra/JSF 2.2. it is not possible anymore to provide a custom FaceletFactory using a web.xml context parameter: <context-param> <param-name>com.sun.faces.faceletFactory</param-name> <param-value>my.faces.overrides.MyFaceletFactory</param-value> </context-param> My application provides some CMS features, including virtual host support to serve different pages (facelets) based on the currently requested domain. So http://www.domain1.com/index.xhtml returns different content than http://www.otherdomain.com/index.xhtml . The mechanics behind that are not that big of a deal using a custom

Facelets multi-level templates - ui:define not rendered

牧云@^-^@ 提交于 2019-11-29 14:31:12
I have 2 basic templates - one with a side menu, and one without - that both ui:include a common page which contains ui:insert tags (templates are largish, so basic example below). Using Mojarra everything worked ok, but now I have migrated to MyFaces the ui:insert tags are ignored and the content of the related ui:define does not get rendered (i.e. 'Here are my results' is not displayed). Should I be specifying included-page.xhtml as a template somehow? I tried <ui:composition template="included-page.xhtml" /> instead of <ui:include src="included-page.xhtml" /> but lost the CSS. Hoping

Stop Eclipse restarting my web app on file save

大城市里の小女人 提交于 2019-11-29 14:06:25
I'm creating a JSF/Facelets web app in Eclipse. I've configured my project to use a Tomcat (6.0) server that is started/stopped by Eclipse. Whenever I save a file (eg .xhtml) Eclipse restarts the app, trashing my HTTP session. This is annoying, because I'm frequently updating my .xhtml files, and the app doesn't need restarting to detect the changes. Is there a way to stop Eclipse restarting the app? Specifically, can I configure Eclipse to only restart the app when I save files of a certain type? In the server View, double click on your Tomcat instance. This will open the properties of your