问题
Everyting I have read about calling Java from Xpages mentions managed beans. But I really don't need to save the state of my object. Do I still need to make my class managed?
What I need to do is to check to see if a password is expired for a user in Directory Services (LDAP). My plan was to check the state using my LDAP class then store the result in a regular session variable. So would I still need to use a managed bean?
If not, do I still need to mention the class in faces-config.xml or anyplace else?
回答1:
As Henrik said you dont need to use a bean.
Here a short example how to call a java class directly. Lets say your class is in the package org.test
in Path:
yourApplication.nsf/webContent/WEB-INF/src/
package org.test;
public class Test{
public static String halloWorld() throws Exception {
return "HalloWorld";
}
}
you can call its Methods by using:
<xp:text value="#{javascript:return org.test.Test.halloWorld();}"></xp:text>
You can find more Infos on that in the IBM wiki.
来源:https://stackoverflow.com/questions/16692194/do-i-really-need-a-managed-bean