managed-bean

JSF / primefaces eventing in diagram elements

允我心安 提交于 2021-02-08 06:15:07
问题 i need to access the data object of an org.primefaces.model.diagram.Element in a managedBean on click of this very element. I am using primefaces 5.2. I tried multiple ways to establish this, but none did work so far. Here is one approach: xhtml: the idea is, to pass the element through a commandLink action attribute (which works fine for e.g. data tables): <fl:composition template="/WEB-INF/template.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:fl=

JSF / primefaces eventing in diagram elements

孤街醉人 提交于 2021-02-08 06:14:15
问题 i need to access the data object of an org.primefaces.model.diagram.Element in a managedBean on click of this very element. I am using primefaces 5.2. I tried multiple ways to establish this, but none did work so far. Here is one approach: xhtml: the idea is, to pass the element through a commandLink action attribute (which works fine for e.g. data tables): <fl:composition template="/WEB-INF/template.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:fl=

What is difference between JavaBean and ManagedBean

被刻印的时光 ゝ 提交于 2020-06-09 12:30:06
问题 I am reading What components are MVC in JSF MVC framework? In the big architectural picture, your own JSF code is the V : M - Business domain/Service layer (e.g. EJB/JPA/DAO) V - Your JSF code C - FacesServlet In the developer picture, the architectural V is in turn dividable as below: M - Entity V - Facelets/JSP page C - Managed bean On the upper case, the JavaBean is a model. But on the lower case, the Managed bean becomes a controller? They are not the same thing? What are the difference?

Opening a new window if condition true in managed bean

廉价感情. 提交于 2020-04-11 10:56:30
问题 I want to implement a situation where the user enter a URL, and if a specified condition is true in my managed bean this URL will be opened in a new web page. I found this possibility: The “h:link” tag is useful to generate a link which requires to interact with the JSF “outcome” , but lack of “action” support make it hard to generate a dynamic outcome. The “h:commandLink” tag is suck, the generated JavaScript is really scary! Not recommend to use this tag, unless you have a solid reason to

Is @javax.annotation.ManagedBean a CDI bean defining annotation?

前提是你 提交于 2020-02-03 04:59:04
问题 The Question Given that the archive we deploy is an "implicit bean archive" (see below), using @javax.inject.Inject to inject a @javax.annotation.ManagedBean into another managed bean work in WildFly 8.1.0, but it won't work in GlassFish 4.0.1-b08 nor GlassFish 4.1-b13. GlassFish crash with this message: WELD-001408: Unsatisfied dependencies for type... Do I misunderstand the following outlined specifications or do GlassFish have a bug? CDI 1.1 Part 1 CDI 1.1 (JSR-346) section 12.1 "Bean

Generate CSS from JSF managed bean

佐手、 提交于 2020-01-24 09:50:06
问题 I have this CSS code: td[data-date='2016-03-08']{ background-color: #F7F7F7; } I want to apply it on several dates that I want to load from a database. All this could happen inside my JSF managed bean where I generate the CSS code. So my question is, how can I apply the CSS that I'm gonna get from my JSF managed bean? 回答1: One way is to print it as body of HTML <style> tag which you put in HTML head. <h:head> ... <style>#{bean.css}</style> </h:head> 来源: https://stackoverflow.com/questions

Why is my @Autowired object null?

最后都变了- 提交于 2020-01-21 20:08:47
问题 I've the below JSF managed bean: package com.example; import java.io.Serializable; import javax.faces.bean.ManagedBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component @ManagedBean public class Bean implements Serializable { @Autowired private SomeService someService; public void update() { someService.update(someEntity); } // ... } And the below Spring service: @Transactional @Repository public class SomeService {

Why is my @Autowired object null?

孤街醉人 提交于 2020-01-21 20:08:23
问题 I've the below JSF managed bean: package com.example; import java.io.Serializable; import javax.faces.bean.ManagedBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component @ManagedBean public class Bean implements Serializable { @Autowired private SomeService someService; public void update() { someService.update(someEntity); } // ... } And the below Spring service: @Transactional @Repository public class SomeService {

CDI beans injection

旧城冷巷雨未停 提交于 2020-01-21 19:16:07
问题 Is this a correct approach to inject @ApplicationScoped bean in @SessionScoped bean? will this lead my application scoped bean to be stored in the session of every user? I have an application scoped bean that contains some values we share among all the system users, and now I need to get that values within a method in a session bean. 回答1: Injecting a bean of the same or a broader scope in another bean is completely legal and correct either in JSF or CDI beans, like the example you provided.