facelets

web.xml setup for facelets template and client

假如想象 提交于 2019-11-28 12:50:01
问题 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

h:commandButton is not working once I wrap it in a <h:panelGroup rendered>

只谈情不闲聊 提交于 2019-11-28 12:45:57
The reason why the topic has "kind of" is because I have an example in JSF 2.2 where I use a commandButton and call a bean function twice (depending on the url). It's basically the same code, which executes only in one example. Here's the code with the description of the "error" below the code: User bean @ManagedBean @RequestScoped public class User { private String name; private String surname; private int age; private int id; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSurname() { return surname; } public void setSurname

h:commandButton multiple actions: download file and render ajax table

本小妞迷上赌 提交于 2019-11-28 12:41:39
I currently have 2 command buttons and one listbox. Based on listbox selection, the result generated can be shown in a download-able file or rendered as an HTML table. The getFile() code is based on BalusC's PDF Handling tutorial , while getTable() sets resultTable . <h:form> <fieldset> <h:selectManyListbox id="listbox" value="#{form.items}"> <f:selectItems value="#{form.allItems}"> </h:selectManyListbox> </fieldset> <h:commandButton value="Get File" action="#{form.getFile}"> <h:commandButton value="Get Table" action="#{form.getTable}"> <f:ajax render="result_table" execute="listbox" /> </h

Exclude css & image resources in web.xml Security Constraint

旧城冷巷雨未停 提交于 2019-11-28 12:18:42
I am using JSF2.1 and Glassfish 3.1.2. I specify a security constraint to block everything: <security-constraint> <web-resource-collection> <web-resource-name>Secured Content</web-resource-name> <!-- Block all --> <url-pattern>/*</url-pattern> </web-resource-collection> <!-- only users with at least one of these roles are allowed to access the secured content --> <auth-constraint> <role-name>ADMINISTRATOR</role-name> </auth-constraint> </security-constraint> and have another to allow access a subset of pages and the resources: <security-constraint> <web-resource-collection> <web-resource-name

Is it possible to change the element id separator in JSF?

谁都会走 提交于 2019-11-28 12:09:43
For example, the following snippet: <h:form id="levelone"> <h:inputText id="leveltwo" value="Test" /> </h:form> generates the following markup: <form id="levelone" name="levelone" method="post" action="/test/testPage.html" enctype="application/x-www-form-urlencoded"> <input id="levelone:leveltwo" type="text" name="levelone:leveltwo" value="Test" /> </form> Is it possible to change the automatically generated ids to use a different separator than colon? For example, I'd like to change levelone:leveltwo to levelone-leveltwo Background We're using the Mojo JavaScript application framework in our

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

自闭症网瘾萝莉.ら 提交于 2019-11-28 11:35:24
问题 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

XML prolog / instruction not removed from XHTML output

落爺英雄遲暮 提交于 2019-11-28 11:01:38
I'm starting to learn JavaServer Faces (JSF). I'm using GlassFish 3+. I've just created a new JSF project in NetBeans and run the project. It worked fine, but upon examining the XHTML output, I noticed the XML declaration was left in. This messes up the DOCTYPE declaration (which is always supposed to be first in the document). Is JSF supposed to remove the XML declaration, or is there something I've done wrong? BalusC Facelets will by default only remove it from compositions (include files and composite components) and tag files. It won't remove it from the master template. Just remove it

javax.el.ELException: Failed to parse the expression [{pz:instanceof(object,'com.project.domain.MyClass')}]

邮差的信 提交于 2019-11-28 10:15:10
Currenty I have a web project with JSF 1.2 and Facelets running in tomcat 6.0.18.0. I decided to upgrade the servlet container, thus i deployed in tomcat 7 and all seemed ok until we hit one view using my custome facelet functions. javax.el.ELException: Failed to parse the expression [{pz:instanceof(object,'com.project.domain.MyClass')}] Caused by: org.apache.el.parser.ParseException: Encountered " ":" ": "" at line 1, column 5. Was expecting one of: "}" ... "." ... "[" ... This error occurs when parsing the following code: <ui:repeat var="object" value="#{objects}"> <ui:fragment rendered="#

NumberFormatException for input String [duplicate]

你。 提交于 2019-11-28 10:02:19
This question already has an answer here: Showing Hibernate/JPA results in JSF datatable causes: java.lang.NumberFormatException: For input string: “[propertyname]” 2 answers I have the following method in a JSF backing bean: public List<Rent> getTopMemebers(){ return rentDAO.findByMonthAndYear(MonthReport, YearReport); } I am displaying this in a datatable: <p:dataTable value="#{rentController.topMemebers}" var="item"> <p:column> <h:outputText value="#{item.rentid}"/> </p:column> ... </p:dataTable> But I got the following exception: SEVERE: Error Rendering View[/admin/index.xhtml] java.lang

JSF 2 facelets <f:metadata/> in template and page

元气小坏坏 提交于 2019-11-28 09:18:15
I have the following template (masterLayout.xhtml): <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> <f:view contentType="text/html"> <ui:insert name="metadata"/> <h:head> <title><ui:insert name="windowTitle"/> | MySite</title> </h:head> <h:body> <div id="container"> <div id="header"> <ui:insert name="header"> <ui:include src="/WEB-INF/templates/header.xhtml"/> </ui:insert> </div> <div id="content"> <ui:insert name="content"/> </div> <div id="footer"> <ui:insert name="footer"> <ui:include src="/WEB