managed-bean

session-scoped managed bean appears to be not session scoped in an xpages application

∥☆過路亽.° 提交于 2019-12-04 14:54:00
I'd wrote a session scoped managed bean to cache the sesion user specific info in a domino xpages application,just like the following codes: public class NBUserInfo { private String fullUserName; private String commonUserName; private String displayName; private String mailAddress; private String themeType; private String themeData; private Session _session; private Database _dbnames; private Name _dominoName; public NBUserInfo(){ System.out.println("初始化Managed Bean:NBUserInfo..."); _session = ExtLibUtil.getCurrentSession(); try { System.out.println(_session.getEffectiveUserName()); _dbnames =

Using jquery ajax to call a jsf managed bean method (an AjaxBehaviorEvent listener handler)

怎甘沉沦 提交于 2019-12-04 12:14:24
问题 i would like to know if there is a way to fire a jsf managed bean method (with an AjaxBehaviorEvent type parameter: the same triggered when using f:ajax) directly by using a jquery ajax server request.By the way , i m a jsf developper and i didn't find an example about using jquery ajax with Java EE as a server-side framework, all examples i found were with php..so i wish to get a complete example about doing that. i think the other workaround maybe is to make a commandLink being submitted

Where should I open / close JMS connections in a JSF ManagedBean?

岁酱吖の 提交于 2019-12-04 11:13:01
In a simple demo web app using JSF 2 and Ajax, there is a method in the ManagedBean which receives messages from a JMS queue: @ManagedBean public class Bean { @Resource(mappedName = "jms/HabariConnectionFactory") private ConnectionFactory connectionFactory; @Resource(mappedName = "jms/TOOL.DEFAULT") private Queue queue; public String getMessage() { String result = "no message"; try { Connection connection = connectionFactory.createConnection(); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer consumer = session.createConsumer

Can @ManagedPropery and @PostConstruct be placed in a base class?

南楼画角 提交于 2019-12-04 08:49:58
I'm using a hierarchy of classes and what I would optimally try to do is have @ManagedBean 's that inherit a class that have @ManagedProperty members and @PostConstruct methods. Specifically, will this work? : public class A { @ManagedProperty private C c; @PostConstruct public void init() { // Do some initialization stuff } public C getC() { return c; } public void setC(C c) { this.c = c; } } @ManagedBean @SessionScoped public class B extends A { // Content... } Thanks in Advance! The @ManagedProperty is inherited and will just work that way. The @PostConstruct will also be inherited,

ManagedProperty of SessionScope inside a ViewScoped Bean - Transient?

给你一囗甜甜゛ 提交于 2019-12-04 07:22:00
I have a JSF Beans structure of this sort: @ManagedBean @ViewScoped public class ViewBeany implements Serializable { .... @ManagedProperty(value='#{sessionBeany}) transient private SessionBeany sessionBeany; ... public getSessionBeany() { ... }; public setSessionBeany(SessionBeany sessionBeany) { ... }; } The reason for the transient is that the session bean has some non-Serializable members and cannot be made Serializable. Will this work? If not, How can I solve the problem of not being able to serialize SesionBeany but having to keep it as a managed property under a view scoped bean? Thanks!

jsf passing parameters in a method expression failes in ViewScoped bean

送分小仙女□ 提交于 2019-12-04 06:33:25
问题 I have jsf page backed by a ViewScoped bean which lists a bunch of transactions like below <ui:repeat value="#{transactions_byaccount.pageList}" var="item"> <tr class="dataRow"> <td class="dataCell cltdtransactionsdatetransaction"> <h:outputText value="#{item.datetransaction}" > <f:convertDateTime pattern="EEE dd-MMM-yyyy HH:mm" /> </h:outputText> </td> ... ... <td colspan="2"> <span class="pagerDBspan" style="font-weight: bold;"> <h:commandLink action="#{transactions_byaccount.updateCategory

Cross field bean validation - why you no work

巧了我就是萌 提交于 2019-12-04 02:39:00
问题 I've got a little problem here with my application. I'd like to check if fields password and confirm password match together, so I tried to do it like in the first answer for this question: Cross field validation with Hibernate Validator (JSR 303) The problem is that it actually doesn't work and I HAVE NO IDEA WHY. Please, help me! This is my first post here, so please don't be too harsh for me. Here's my Annotation : /* * To change this template, choose Tools | Templates * and open the

Is there a way to call a method upon leaving a page with JSF or PrimeFaces?

送分小仙女□ 提交于 2019-12-03 18:02:40
问题 Is there a way to call a method upon leaving a page with JSF? 回答1: Not when using native JSF or PrimeFaces. Your best bet would be to hook on session expiration instead. import javax.inject.Named; import javax.enterprise.context.SessionScoped; @Named @SessionScoped public class Bean implements Serializable { @PreDestroy public void destroy() { // Your code here. } } If you happen to use the JSF utility library OmniFaces, then you can use its @ViewScoped. This will call the @PreDestroy when

Dynamically bind an Edit Box in a custom control to a managed bean

这一生的挚爱 提交于 2019-12-03 17:00:15
I've read a number of excellent posts and articles about dynamically binding fields in a custom control, but they have all assumed a document data source. I want to allow the possibility of a managed bean data source. I tried setting the property type to com.ibm.xsp.model.DataSource or com.ibm.xsp.extlib.model.ObjectDataSource and neither of those work with the following xml: <xp:inputText id="input" value="${compositeData.dsn[compositeData.fieldName]}" > </xp:inputText> Where the control is used I have passed in custom data like so: <xc:input dsn="#{issue}" fieldName="Database" > </xc:input>

Inject vs ManagedProperty [duplicate]

柔情痞子 提交于 2019-12-03 16:53:55
问题 This question already has answers here : Backing beans (@ManagedBean) or CDI Beans (@Named)? (5 answers) Closed 3 years ago . Okay, so I have a JSF backing bean that needs a reference to another (@NoneScoped) bean. Should I @Inject it or use @ManagedProperty to obtain an instance reference from the container? Why use one and not the other, in my mind the two approaches achieve the same thing. 回答1: @ManagedProperty and @NoneScoped comes from the JSF 2.0 spec whilst @Inject comes from the CDI