jsf-2

How to create a picklist in JSF? Tried moving items using JS/jQuery, but submit errors with “Validation Error: Value is not valid”

孤人 提交于 2019-12-18 09:14:55
问题 I am creating web application using JSF 2.0 where I am assigning users to view projects. For that I have two list. First list that have users who are not assigned that project and list B have users who have assigned that project. And we can interchange the data. Code I have is <t:selectManyListbox id="sourceCars" style="width: 40%;" value="#{PersonalInformationDataBean.listOfUsers}" size="10"> <t:selectItems value="#{PersonalInformationDataBean.showAllMyRemData()}" var="t" itemLabel="#{t

Session lost in Google App Engine using JSF

孤街醉人 提交于 2019-12-18 09:11:39
问题 I have configured JSF 2.1 in my Google App Engine application following the indications at: https://sites.google.com/a/wildstartech.com/adventures-in-java/Java-Platform-Enterprise-Edition/JavaServer-Faces/javaserver-faces-21/configuring-javaserver-faces-21-to-run-on-the-google-app-engine-using-eclipse The application works perfectly when running locally, but the session is lost when deployed at Google App Engine, e.g.: the component values are lost when updating any other component in the

Pass an input value directly as action method argument

﹥>﹥吖頭↗ 提交于 2019-12-18 09:09:17
问题 Is there a way to do pass an input value as a action's parameter without using managed properties? i.e. <h:form> <h:inputText id="input" /> <h:commandButton action="#{someBean.doSome(input)}" /> </h:form> 回答1: Yes, it's during the form submit already there in the JSF component state. Just bind the input component to the view by binding attribute, which will reference an UIInput instance, which in turn has a getValue() method for the very purpose of retrieving the input value (so that you can

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

ε祈祈猫儿з 提交于 2019-12-18 09:08:37
问题 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

Are there going to be two instances for a bean if I write @managed bean annotation and define same in faces-config.xml

依然范特西╮ 提交于 2019-12-18 09:06:53
问题 In my application in some places we are using @ManagedBean annoation for Person bean and for the same Person bean we defining in the faces-confing.xml like below at the same time. @ManagedBean("name=person") @SessionScoped Public class Person{ } faces-config.xml <managed-bean> <managed-bean-name>person</managed-bean-name> <managed-bean-class>com.test.sample.Person</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> my question is does this approach create two

Composite component with custom backing component breaks strangely when nested inside ui:repeat

倖福魔咒の 提交于 2019-12-18 09:04:56
问题 My problem in brief is that I have a composite component with a componentType specified. When I use the composite component alone on a page, it works fine. When I nest it inside another composite component (also inside a ui:repeat), I get an exception trying to find the properties I've defined on componentType class inside a UINamingContainer--which is the wrong class. I have found I can solve that problem by replacing cc.whatever with component.parent.parent.parent.whatever but I find that a

JSF Navigation with Ajax

萝らか妹 提交于 2019-12-18 08:57:48
问题 If I place, for instance, the following component and click it, it behaves as expected: <h:commandLink value="Click me" action="anotherPage.jsf" /> But if I use Ajax: <h:commandLink value="Click me" action="anotherPage.jsf"><f:ajax /></h:commandLink> It doesn't navigate to the other page. Am I missing something? Isn't this supposed to work? Another issue is that, when I click a button that is using ajax after session timeout, the application redirects to the login page but it doesn't load css

How to iterate a HashMap with primefaces selectable datatable

拜拜、爱过 提交于 2019-12-18 08:57:00
问题 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"); } }

h:selectOneMenu generic converter for all entities without calling DB again and again

我是研究僧i 提交于 2019-12-18 08:55:37
问题 I want to get selected object from <h:selectOneMenu> , but the problem is I couldn't find any generic converter for all type of entities. My first question is, is there a generic converter for all type of entities? I don't want to write another converter again for each other entity. My second question is, is there a way to get selected object without any converter? I don't want to call the DB again and again. I have a Car entity with id and name properties. 回答1: My first question is, is there

JSF Ajax render lose CSS with Jquery Mobile

你说的曾经没有我的故事 提交于 2019-12-18 08:54:39
问题 I'm using ajax to programming with Jquery Mobile, and it was good, ultil I try use ajax to render something :( I'm trying to do a h:selectOneMenu refresh the items when I select another h:selectOneMenu, and I put it inside a h:panelGroup to work. However, when the ajax is executed, and the panelGroup is updated, the selectOneMenu lose the JM css and become ugly. I'm using jsf 2.2 and Jquery Mobile 1.4 Beta Before: After: This is my page. I guess the bean doesn't metter, because the ajax is