Hello,
 
I'm new to Jetspeed 2 and for starting purposes I want to develop a simple
JSF application (with JSF bridge) which creates a new Jetspeed user.
The problem is that I do not know how to access the Jetspeed UserManager
from the JSF application. I can access the UserManager from my portlet, but
how do I pass it to a JSF bean?
 
Here is the source:
 
Portlet:
 
package com.Usermanagement;
 
import javax.portlet.PortletConfig;
import javax.portlet.PortletContext;
import javax.portlet.PortletException;
import org.apache.portals.bridges.jsf.FacesPortlet;
import org.apache.jetspeed.security.UserManager;
 
 
public class UserPortlet extends FacesPortlet {
            
            //const to access Jetspeed built-in UserManager
            private final String USERMANAGER = "cps:UserManager";
            
            private PortletContext context;
            private UserManager manager;
 
 
            public void init(PortletConfig config) throws PortletException {
 
                        super.init(config);
 
                        context = getPortletContext();
                        manager = (UserManager)
context.getAttribute(USERMANAGER);
 
            }
            
}
 
UserBean (where I want to access the UserManager):
 
package com.Usermanagement;
 
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.context.ExternalContext;
import org.apache.jetspeed.security.*;
 
 
public class UserBean {
 
            
            private String username = null;
            private String password = null;
            
            public String getPassword() {
                        return password;
            }
            
            public void setPassword(String password) {
                        this.password = password;
            }
            
            public String getUsername() {
                        return username;
            }
            
            public void setUsername(String username) {
                        this.username = username;
            }
            
            public String addUser()
            {
                        //here I want to access Jetspeed UserManager
                        //add new User
                        return "success";
            }
 
} 
 
Thanks for your help!
 
PS: Sorry for my bad English.

Reply via email to