facelets

Internationalization (i18n) using JSF Facelets: Messages in Java-classes

我只是一个虾纸丫 提交于 2019-12-02 01:47:47
问题 I have successfully implemented i18n in my project. Now I'm stuck in my Bean... private String pageTitle; public List<Product> getProductsByCategory(String category) { if(validate(category)) { pageTitle = category; return service.getProductsByCategory(String category); } else { pageTitle = "Random products"; return service.getRandomProducts(); } } As you can see, I would like to let my pageTitle depend on the result of the provided method. All fine, but this is not fine considering

Extract XML namespace declarations into separate tagfile/taglib

…衆ロ難τιáo~ 提交于 2019-12-01 23:04:22
I would like to seperate my XML namespace declarations at the top of the page into a seperate (tag)file in which I can include in any Facelets page I wish. Is this possible? Or do I need to copypaste all XML namespaces in each Facelets file? Here's a theoretical example, xmlns.xhtml : <something xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" 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" ... /> And the template file which could use it: mypage.xhtml : <f:view xmlns="xmlns.xhtml"> <h:head

Internationalization (i18n) using JSF Facelets: Messages in Java-classes

柔情痞子 提交于 2019-12-01 23:00:41
I have successfully implemented i18n in my project. Now I'm stuck in my Bean... private String pageTitle; public List<Product> getProductsByCategory(String category) { if(validate(category)) { pageTitle = category; return service.getProductsByCategory(String category); } else { pageTitle = "Random products"; return service.getRandomProducts(); } } As you can see, I would like to let my pageTitle depend on the result of the provided method. All fine, but this is not fine considering internationalization. I have tried using a Properties.load(new FileInputStream) approach, but this does not work

Override ui:insert and ui:include-Handler

旧时模样 提交于 2019-12-01 22:48:52
问题 There are many other topics about how to override an existing renderer in JSF. All of them lead to the same entry in faces-config. You "only" need a component-family , renderer-type , render-kit-id and your implementenation in renderer-class I understand and can reproduce all of these examples, but in my specific case I would like to override the behavior of <ui:include> and <ui:insert> . Sadly I cannot find out, which values I have to put in the attributes mentioned above, because the file

Override ui:insert and ui:include-Handler

南笙酒味 提交于 2019-12-01 22:32:29
There are many other topics about how to override an existing renderer in JSF. All of them lead to the same entry in faces-config. You "only" need a component-family , renderer-type , render-kit-id and your implementenation in renderer-class I understand and can reproduce all of these examples, but in my specific case I would like to override the behavior of <ui:include> and <ui:insert> . Sadly I cannot find out, which values I have to put in the attributes mentioned above, because the file ui:taglib.xml is not as verbose as the other taglibs. Do you have any idea, how to override them? Edit:

JSF2 /…registerHostUser.xhtml @9,9 <h:head> Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag was defined for name: head

只谈情不闲聊 提交于 2019-12-01 22:03:16
问题 i am new to JSF 2 as i am trying to do a hello world example to familarise myself, i hit this error which i have been trying out for quite some days. StackTrace om.sun.facelets.tag.TagException: /facelets/register/host/registerHostUser.xhtml @9,9 <h:head> Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag was defined for name: head at com.sun.facelets.compiler.CompilationManager.pushTag(CompilationManager.java:193) at com.sun.facelets.compiler.SAXCompiler

XML Parsing Error: no element found Location: http://localhost:8081/web-app/pages/login.xhtml Line Number 1, Column 1: ^

泄露秘密 提交于 2019-12-01 21:42:03
问题 My login.xhtml starts with: <?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"> I am using Java 8, JSF, Primefaces, Maven, Tomcat8. I think that something is wrong with my configuration e.g. servlets and web.xml . 回答1: XML Parsing Error: no element found Location: [...] Line Number 1, Column 1 To the point, this exact error means that the webbrowser retrieved an entirely empty

JSF2 /…registerHostUser.xhtml @9,9 <h:head> Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag was defined for name: head

非 Y 不嫁゛ 提交于 2019-12-01 21:24:32
i am new to JSF 2 as i am trying to do a hello world example to familarise myself, i hit this error which i have been trying out for quite some days. StackTrace om.sun.facelets.tag.TagException: /facelets/register/host/registerHostUser.xhtml @9,9 <h:head> Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag was defined for name: head at com.sun.facelets.compiler.CompilationManager.pushTag(CompilationManager.java:193) at com.sun.facelets.compiler.SAXCompiler$CompilationHandler.startElement(SAXCompiler.java:194) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser

How do I attach a FacesMessage from the backing bean to a specific field in a ui:repeat?

家住魔仙堡 提交于 2019-12-01 20:56:13
I have a form with a variable number of input elements, like this: <ui:repeat var="_lang" value="#{myBean.languages}"> <h:inputTextarea value="${_lang.title}" id="theTitle" /> <h:messages for="theTitle"/> </ui:repeat> When a certain method in the backing bean is triggered, I want to add a message to, say, the second iteration of the ui:repeat , but not the other ones. I've seen different variations of this question around here , and all problems appear to be due to the ui:repeat 's iterations not being available in the JSF component tree. What I have tried so far: Bind the h:inputTextarea s to

XML Parsing Error: no element found Location: http://localhost:8081/web-app/pages/login.xhtml Line Number 1, Column 1: ^

蹲街弑〆低调 提交于 2019-12-01 20:36:32
My login.xhtml starts with: <?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"> I am using Java 8, JSF, Primefaces, Maven, Tomcat8. I think that something is wrong with my configuration e.g. servlets and web.xml . BalusC XML Parsing Error: no element found Location: [...] Line Number 1, Column 1 To the point, this exact error means that the webbrowser retrieved an entirely empty response while it is being instructed to interpret the response as XML, usually via the Content-Type header