public void doPost(HttpServletRequest pReq, HttpServletResponse pResp) throws ServletException {
try {
final String action = pReq.getParameter("action");
ModuleContext moduleContext = CurrentModuleContext.getContext();
AccountService accountServices = (AccountService) moduleContext.locateService("AccountServiceComponent");
if (accountServices == null) {
throw new ServletException("AccountServiceComponent");
}
ProfileService profileServices = null;
if (!"createAccount".equals(action)) {
profileServices = (ProfileService) moduleContext.locateService("ProfileServiceComponent");
if (profileServices == null) {
throw new ServletException("ProfileServiceComponent not found.");
}
if (!profileServices.isLoggedIn()) {
throw new ServletException("User id '" + profileServices.getId() + "' not logged on.");