jsf-2

Components are with the same id inside ui:repeat

假装没事ソ 提交于 2019-12-29 07:53:04
问题 Unfortunately, primefaces accordionPanel doesn't works well in version 2.2.1 if you are trying to create tabs dynamically. This is my case, I need to create accordions if the user clicks an add icon, and remove if he clicks on x icon. No problem, I've created my own composite component, like you can see here: <c:interface> <c:attribute name="titulo" default="" required="false" /> <c:attribute name="renderizar" default="true" required="false" /> <c:attribute name="width" required="false"

libraries for JSF (Sun/Oracle Mojarra)

六月ゝ 毕业季﹏ 提交于 2019-12-29 07:48:15
问题 I am downloading Sun/Oracle Mojarra implementation of JSF from http://javaserverfaces.java.net/download.html I downloaded the latest -2.1.9 binary. It comes with only one jar - javax.faces-2.1.9.jar. I had a sample project which I believe is using the older 2.0 version, which includes 2 jars - jsf-api.jar and jsf-impl.jar. I replaced those 2 older jars with the single new jar. It seems like the sample project still works well. My question: Is there anything else I need to do besides replacing

JSF form post with AJAX

感情迁移 提交于 2019-12-29 07:32:16
问题 I want the following form to use AJAX. So the comments are shown after clicking the command button and without reloading the page. What needs to be changed, using Java Server Faces 2.0? Functionality: This form provides an inputText to define a topic. After pressing the commandButton, it is searched for comments regarding this topic. Comments are shown in a dataTable, if there are any. Otherwise Empty is shown. <h:form id="myForm"> <h:outputLabel value="Topic:" for="topic" /> <h:inputText id=

How to prevent multiple composite components reset themselves on a JSF page?

南笙酒味 提交于 2019-12-29 07:09:11
问题 I put this problem in a simple example, a composite component that calculates the sum of 2 inputs and prints the result in an outputText Main JSF page: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ez="http://java.sun.com/jsf/composite/ezcomp/"> <h:head></h:head> <h:body> <ez:Calculator /> <br/> <br/> <ez:Calculator /> <br/> <br/> <ez:Calculator /> </h:body> </html> Composite component XHTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional/

Illegal Syntax for Set Operation: How to tell JSF I don't “want” a setter

ε祈祈猫儿з 提交于 2019-12-29 06:52:26
问题 This question may be more of the type "conceptual" or "I don't understand JSF". My scenario: I have a JSF Page ( index.xhtml ) where I use a p:accordionPanel (but I don't think it matters what component it is). What I want to do is to set the activeIndexes of it. <p:accordionPanel multiple="true" activeIndex="#{myController.getActiveIndexesForSections('whatever')}"> // bla bla... </p:accordionPanel> And the (simplified) method in the backing bean: public String getActiveIndexesForSections

How to display value of List#size() in JSF EL?

爱⌒轻易说出口 提交于 2019-12-29 05:43:05
问题 I'd like to know if there's a way to bind the returned value of a method into a JSF component. I'll explain myself better. Let's say I have a class like this: public class Document { private List<Attachment> attachments; //getter and setter here } this class is exposed to jsf through a registered managed bean in a property called currentDocument, and used in a jsf this way <h:outputText value="#{myManagedBean.currentDocument.attachment.size}" /> This isn't correct, I know. But what is the

JSF resetting form after submit

纵饮孤独 提交于 2019-12-29 04:28:10
问题 i have a small problem with my jsf form. i made an example registration form with a submit button and a reset button: <?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"> <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"> <h:head> <title>Register</title> </h:head> <h:body>

How does JSF find beans annotated with @ManagedBean?

亡梦爱人 提交于 2019-12-29 03:31:07
问题 As far as I know, for using @Annotations (or [Attributes] in C#) you have to have a reference to the class metadata, so that you can ask if the class is annotated (attributed) or not. My question is how does JSF implementation find all classes annotated with @ManagedBean? Does it scan all of the classes in the class path? Or is there a way to actually "query" the JVM for the annotated classes? I'm asking this because when I put my annotated backing beans in my web project directly, there's no

JSF 2.0: use Enum values for selectOneMenu [duplicate]

南笙酒味 提交于 2019-12-29 02:48:14
问题 This question already has answers here : How to use enum values in f:selectItem(s) (4 answers) Closed 4 years ago . I'm using JSF 2.0 and want to fill a selectOneMenu with the values of my Enum. A simple example: // Sample Enum public enum Gender { MALE("Male"), FEMALE("Female"); private final String label; private Gender(String label) { this.label = label; } public String getLabel() { return this.label; } } Unfortunately, i can't use Seam for my current project, which had a nice <s

Using bootstrap related tags inside JSF2 h:inputText component

好久不见. 提交于 2019-12-29 01:53:13
问题 Is there anyway to use bootstrap related tags in JSF2 components? For example I'm interested in using the bootstrap typeahead feature which requires something like <h:inputText id="typeahead" type="text" data-provide="typeahead"></h:inputText> but since data-provide doesn't exist for h:inputText it gets stripped out and so the typeahead feature would obviously not work. 回答1: Depends on JSF version you're using. In JSF 2.0/2.1 , it's not possible to specify additional attributes. The JSF HTML