facelets

How to pass dynamic parameter to backing bean using EL 2.2 method expression? [duplicate]

我的梦境 提交于 2019-12-22 14:03:19
问题 This question already has answers here : Invoke direct methods or methods with arguments / variables / parameters in EL (2 answers) Closed 3 years ago . I'm trying to call a function from a JSF 2.0 page in my backing bean passing a dynamic parameter. It works fine as long as im passing a static string, but when I try using a dynamic one, I always get an EL parsing error. I guess its a syntax problem, but I can't think of another way to do this using method expression. I know that I could do

Can I add a meta tag to a particular page that is using templates

馋奶兔 提交于 2019-12-22 13:57:00
问题 I have a page that uses a template <ui:composition template="/WEB-INF/facelets/templates/clientPage.xhtml"> I was hoping to only render the compatibility view for this particular page using the meta tag <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /> The tag does not work unless I add it to the root template page. Is there a way I can add it to specific pages that use the template. 回答1: Declare an <ui:insert> in the master template at the desired location: clientPage.xhtml <

How to use both Navigation Rule and f:ajax

强颜欢笑 提交于 2019-12-22 11:01:41
问题 Here's my scenario: I'd like to update a page via Ajax in some cases, in other cases, execute a navigation rule. My use case is a login form. I'd like them to receive an error message via ajax if their uname/password fails, but navigate to a new page if it succeeds. Has anyone done this using JSF2.0 f:ajax apis? I'm not really interested in solutions that go outside standard facelets, jsf2.0, etc. 回答1: It's not different from when doing it without ajax. Just return the next view ID as String

Quick way to create JSF custom component

喜欢而已 提交于 2019-12-22 09:25:00
问题 I know of two ways of creating custom JSF components: 1. Native JSF way: creating JSF component class, tag, etc. 2. Facelets way: defining component in a xhtml file and then creating appropriate decrption in facelets taglib. Currently I work on a project in which introducing facelets is unfortunately out of the question. On the other hand, creating custom components the standard JSF way seems like a pain in the ass. Is there maybe a third party library that allows creating custom components

How to evaluate MethodExpressions in JSF composite components

点点圈 提交于 2019-12-22 08:55:04
问题 I am not sure about the "correct" way to deal with method expressions in composite components. My composite uses a backing class with action methods. Theses perform some default actions or delegate to an action method passed by the composite user as an attribute: In using page: <my:component action="#{myBean.actionMethod}" /> Composite: <cc:interface componentType="mycomponentType"> <cc:attribute name="action" method-signature="java.lang.String action()" required="false" /> </cc:interface>

includeViewParams=true doesn't work in templated pages

走远了吗. 提交于 2019-12-22 08:54:42
问题 Consider this template: <!DOCTYPE html> <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:ui="http://java.sun.com/jsf/facelets"> <f:view contentType="text/html"> <ui:insert name="metadata"/> <h:head> <title></title> </h:head> <h:body> <ui:insert name="content"/> </h:body> </f:view> </html> this page that uses it (/pages/test.xhtml): <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"

includeViewParams=true doesn't work in templated pages

跟風遠走 提交于 2019-12-22 08:54:17
问题 Consider this template: <!DOCTYPE html> <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:ui="http://java.sun.com/jsf/facelets"> <f:view contentType="text/html"> <ui:insert name="metadata"/> <h:head> <title></title> </h:head> <h:body> <ui:insert name="content"/> </h:body> </f:view> </html> this page that uses it (/pages/test.xhtml): <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"

Facelets without JSF

本小妞迷上赌 提交于 2019-12-22 05:46:32
问题 I'm finishing on learning the Java language and looking to write very small web applications, since Facelets seems to be the replacement for JSP, and JSF seems overkill for small web apps, can I just learn Facelets and use it without the whole JSF stack? or should I just go with JSP for this small web apps? 回答1: It can be used without JSF. Just map the FacesServlet on an URL pattern of *.xhtml in web.xml and do not declare xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com

ui:define with rendered=“false” attribute still rendering

十年热恋 提交于 2019-12-22 04:45:24
问题 <ui:define name="description" rendered="false"> <meta name="description" content="do not render" /> </ui:define> i'm using this code in my xhtml page, when i run the app, meta description is still rendering. i want to use meta description tag depending on some conditions. master layout: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <ui:insert name="description" /> </h:head> ........... </html> web page:

Facelets: ui:param default value

試著忘記壹切 提交于 2019-12-22 04:32:35
问题 How can one define a default value for a facelet template parameter? Consider the following element using a template parameter: <h:outputText value="#{templParam}"></h:outputText> The above line will print the the template parameter templParam which is passed by a ui:param tag in a ui:composition using the template: <ui:param name="templParam" value="Hello world"></ui:param> But if ui:param tag is missing nothing will be printed. Although, how can one print e.g "Default value" in this case?