managed-bean

JSF Named Bean, Eager application scoped (aka @ManagedBean(eager=true) )

断了今生、忘了曾经 提交于 2019-12-23 10:09:30
问题 Is there any way to initialize Named Bean annotaded by javax.inject.Named / javax.enterprise.context.ApplicationScoped like @ManagedBean(eager=true) from javax.faces package? @Named @ApplicationScoped public Mail() { ... } I want to load this class when application starts, not when webapplication refers to this bean. ps. JSF 2.1 Bean Injected by Glassfish 3.1 回答1: You can create a CDI extension that has the @Observes AfterBeanDiscovery parameter on one of his methods. There you can

Passing text field values from jsf page to managed bean [duplicate]

倖福魔咒の 提交于 2019-12-23 06:38:49
问题 This question already has an answer here : How to send form input values and invoke a method in JSF bean (1 answer) Closed 2 years ago . I have a JSF form which calls a method of a managed bean when the action button is clicked. The method is successfully called, but now I would like to access the values entered in the form field from the bean. Here is my code. The view: <h:form class="form-horizontal" action= "#{hello_World.message}" method="post" id="formId"> <div class="control-group">

Passing text field values from jsf page to managed bean [duplicate]

旧城冷巷雨未停 提交于 2019-12-23 06:38:07
问题 This question already has an answer here : How to send form input values and invoke a method in JSF bean (1 answer) Closed 2 years ago . I have a JSF form which calls a method of a managed bean when the action button is clicked. The method is successfully called, but now I would like to access the values entered in the form field from the bean. Here is my code. The view: <h:form class="form-horizontal" action= "#{hello_World.message}" method="post" id="formId"> <div class="control-group">

ViewScoped bean is recreated everytime I click on commandButton in my dataTable

浪子不回头ぞ 提交于 2019-12-23 05:49:10
问题 Im using primefaces version 3.1.1, Mojarra 2.1.3, Netbeans 7.0.1, Glassfish Server 3.1. My test application is using a facelet template with top, left, content, right and bottom layout with raw divs and css. After user logs in with container managed jdbcrealm, they will be presented with the main index.html which use the said template. I put a navigation menu on the left panel which will subsequently update center panel content with ajax upon clicking menuitem. The center panel will be

Java class name convention with respect to managed been usage in Primefaces

南楼画角 提交于 2019-12-23 03:25:17
问题 I am using Eclipse Indigo and whenever I create a new class starting with lower case then a warning is shown as displayed below (" Type name is discouraged. By convention, Java type names usually start with an uppercase letter"). Now in my xHTML / JSF file, if i try to access the class with first letter in caps then it is not accessible e-g; '#{MyClass.variableName}' is NOT accessible nor the class constructor is called whereas '#{myClass.variableName}' works fine. Note: class has an

ManagedProperty not working

时光毁灭记忆、已成空白 提交于 2019-12-22 18:44:12
问题 I have problem with JSF 2 property binding and honestly I hit a wall here.. What I want to accomplish is this: a request-scoped bean (loginBean) process login action and stores username in the session-scoped bean (userBean). I want to inject userBean into loginBean via @ManagedProperty, but when loginBean.doLoginAction is called, userBean is set to null. Here is the code: UserBean class import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean @SessionScoped

JSF request-scoped managed bean http-session causes in-instantiation

你离开我真会死。 提交于 2019-12-21 23:45:58
问题 I'm using a SessionFilter servlet for validating users and then giving access of the system to them. My restricted files are in a folder named "com.shadibandhan.Restricted". Session filter is working fine. here's the relevant code of the sessionfilter servlet @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse)

Set properties to jsf managed-bean

£可爱£侵袭症+ 提交于 2019-12-21 21:43:34
问题 Have following first .jsf: <ui:repeat var="prod" value="#{showProducts.decoys}"> <h:form> {prod.price} {prod.weight} {prod.size} > <h:commandButton value="Buy" action="shoppingCart"/> </h:form> </ui:repeat> Have following shoppingCart.jsf: <h:form> <h:dataTable value="#{prod}"> <h:column> #{prod.name}<br/> </h:column> <h:column> #{prod.price}<br/> </h:column> <h:column> <h:inputText value="#{prod.count}" size="3"/> </h:column> </h:dataTable> <h:inputText value="#{order.phone}"/><br/> <h

Why should we make a SessionScoped ManagedBean thread safe in JSF?

冷暖自知 提交于 2019-12-21 12:09:13
问题 I know that Application-Scope persists across multiple users, so it's obvious that we should make sure that all the ApplicationScoped ManagedBeans are thread safe. I also understand that we don't need to care about thread safety for a RequestScoped ManagedBean. That's because it last only for one HTTP request, and is newly instantiated for each request if it's referenced. But I am not quite sure why we should worry about thread safety for a SessionScoped ManangedBean. Even though it persists

ejbFacade is null

╄→гoц情女王★ 提交于 2019-12-20 02:54:22
问题 I call the managedBean OverzichtAlle.java from the jsf page overzichtAlleGroepen.xhtml But when I get on this page i get the errormessage can't instantiate managedBeans.OverzichtAlle due to a Nullpointerexception... When I debug, I see that my ejbFacade is null.. this is the EJB @EJB private ProjecttypeEFacade ejbFacade; and this is my constructor: public OverzichtAlle() { projE = ejbFacade.findAll(); omvormenProjectTypes(); } projE is a List (entity-list) What am i doing wrong? 回答1: @EJB s