managed-bean

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

SelectOneMenu updates other SelectOneMenu

百般思念 提交于 2019-12-28 16:07:10
问题 I want to update the second SelectOneMenu when I select any item of the first SelectOnMenu. As it is now, I get the values for the SelectOneMenus from a ManagedBean. I guess I've to use AJAX (jquery) to send parameters to the ManagedBean. <h:form> <div class="center"> <h:panelGrid id="editTable" columns="2" styleClass="center"> ... <h:outputText value="#{msg.timetable_list_category}" /> <h:selectOneMenu class="category"> <f:selectItems value="#{categoryBackingBean.categorys}" var="c"

sessionscoped managed bean vs stateful ejb

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-28 11:57:08
问题 If I have a @ManagedBean that's @SessionScoped , why would I use a @Stateful EJB? I used it before for shopping carts and maintaining a conversational state, but since a managed bean will be kept during the user session I can store state there, then call SLSB for bussiness logic. Is that correct? If it is, then stateful ejbs will be left for more specific applications such as when you need transactions etc? 回答1: Very often stateless session beans can be used for a lot of business problems.

Passing parameters between managed beans with request scope

二次信任 提交于 2019-12-28 06:26:27
问题 Im working on a web application using JSF2 . I want to pass parameters from a managed bean in backing bean action and I want to retrive the same parametrs in an other managed bean the both with a request scope. Thanks in advance. 回答1: Use <f:param> in the command link/button and use @ManagedProperty or <f:viewParam> in the target bean or view. E.g. <h:commandButton value="Submit" action="#{otherBean.submit}"> <f:param name="foo" value="#{oneBean.foo}" /> </h:commandButton> with in OtherBean

primeFaces fails to upload file to db

杀马特。学长 韩版系。学妹 提交于 2019-12-25 05:22:46
问题 I am trying to upload a file (picture) which is part of a Product object to a database. The file upload is successful according to the jsf confirmation. However, when persisting Product the persistence is completed successfully without the picture. The server is not returning any stack. This is my form (simplified): <h:form enctype="multipart/form-data"> <h1><h:outputText value="Create New Product"/></h1> <h:panelGrid columns="2"> <h:outputLabel value="Name:" for="name" /> <h:inputText id=

Passing request scoped variable passed as EL action method parameter does not work

不打扰是莪最后的温柔 提交于 2019-12-25 04:33:49
问题 I am using JSF 2.2 on Glassfish 4.1. I am trying to pass in a query parameter to as an action method argument as follows: // Example 1. This does not work. // at url http://localhost:8080/app/order.xhtml?email=test@email.com <p:commandButton value="Place order" action="#{orderManager.placeOrder(param['email'])}" /> (Know that param is an implicit EL object.) In the server log I have configured it to print the method parameter, but I can see that an empty string was passed-in, not "test@email

What managed bean scope should I use?

我的梦境 提交于 2019-12-25 03:52:04
问题 I have 3 different page where I use list of Users. First page contains dataTable with users from one session scope managed bean. On that page I can change selected user details. Second page also contains dataTable with users, but from different session scope bean. On this page I delete users from dataTable (list of users) and data base too. I realized that this is not good idea, because if I made changes on one user, that changes will not be shown on page where I delete users. Is application

Composite component with navigation using managed bean

允我心安 提交于 2019-12-25 03:28:08
问题 I created a composite component that receives a managed bean as a parameter. The composite has a submit h:commandButton that runs a method from the managed bean parameter ( #cc.attrs.mBean.action} ; signature: String action() ). Knowing about the use of the target attribute in composite:implementation if I were using a method-signature instead of a bean action: is there a way to achieve a similar behavior when using a bean method? Other reads: Unable to find matching navigation case from

Calling a JavaScript function from managed bean

烂漫一生 提交于 2019-12-25 02:59:34
问题 Is there a way to call (execute) a JavaScript function from managed bean in JSF? If that's relevant, I'm also using PrimeFaces. 回答1: In PrimeFaces pre 6.2, you can use RequestContext#execute() for this. public void submit() { // ... RequestContext.getCurrentInstance().execute("alert('peek-a-boo');"); } In PrimeFaces 6.2 and up: public void submit() { // ... PrimeFaces.current().executeScript("alert('peek-a-boo');"); } In standard JSF, there is no direct public API for that. Best what you can

adf tree selection listner not working getting error <oracle.adf.view> <RichRenderer> <decodeUnknownKey> <ATTEMPT_SYNC_UNKNOWN_KEY>

亡梦爱人 提交于 2019-12-25 02:33:19
问题 I have created a tree in adf programtically. It's showing correctly and I am also able to traverse but when I try clicking on any node, my selectionListner() function does not work instead it gives following error on console: <oracle.adf.view> <RichRenderer> <decodeUnknownKey> <ATTEMPT_SYNC_UNKNOWN_KEY>** Following is my code 1) I create an Employee class package view; import java.util.ArrayList; import java.util.List; public class Employee { private String name; private String location;