This is my SessionBean class where i am using it what i am trying to achive is that if a user directly try to open the page by tying a URL e.g "http://localhost:8080/ereg/secretquestions.jsp" then the LoggedInIntercepter should check first that user is logged in or not if not that return to some specific page (navigation specified in the faces-config.xml )....
@Stateful @Scope(SESSION) @Name("SecretQuestionsAction") @Interceptors(LoggedInInterceptor.class) public class SecretQuestionsAction implements SecretQuestionsLocal{ @PersistenceContext(unitName="Database") protected EntityManager em; @In(required=false,value="SecretQuestions") @Out(required=false,value="SecretQuestions") private SecretQuestions secretQuestions; @DataModel private List allSecretQuestionsList; @DataModelSelection(value="allSecretQuestionsList") private SecretQuestions selectedSecretQuestion; @In private Context sessionContext; @In(create=true) FacesMessages facesMessages; int mode=0; String acknowledge = null; /*--------------------------------------------------------------------*/ public String toSecretQuestionsPage(){ System.out.println("toSecretQuestionsPage method..."); return "/secretquestions.jsp"; } public String addSecretQuestion(){ try{ if(!validateOpts()){ em.persist(secretQuestions); secretQuestions=null; sessionContext.remove("SecretQuestions"); getSecretQuestionsList(); acknowledge = "The Record is added successfully."; }else{ return null; } }catch(Exception e){ System.out.println("Error Have accoured in\n\t SecretQuestions.java --> addSecretQuestion()? \n\t"+e.getMessage()); } return "success"; } /*--------------------------------------------------------------------*/ public boolean validateOpts(){ boolean isError=false; if(secretQuestions.getSecretQuestion()==""){ facesMessages.add("secretQuestion",new FacesMessage("Please enter secret question")); isError=true; } return isError; } /*--------------------------------------------------------------------*/ @Factory("allSecretQuestionsList") public String getSecretQuestionsList(){ try{ setMode(0); acknowledge = null; allSecretQuestionsList = em.createQuery("from SecretQuestions e where e.isDeleted=0").getResultList(); }catch(Exception e){ System.out.println("Error Have accoured in\n\t SecretQuestions.java --> getSecretQuestionsList()? \n\t"+e.getMessage()); } return null; } /*--------------------------------------------------------------------*/ public String deleteSecretQuestion(){ try{ SecretQuestions deleted = em.find(SecretQuestions.class, selectedSecretQuestion.getId()); if(deleted != null){ deleted.setIsDeleted(1); } deleted = null; sessionContext.remove("SecretQuestions"); secretQuestions=null; getSecretQuestionsList(); acknowledge = "The Record is deleted successfully."; System.out.println("getting the result list complete \n\t"); }catch(Exception e){ System.out.println("Error Have accoured in\n\t SecretQuestions.java --> deleteSecretQuestion()? \n\t"+e.getMessage()); } return null; } /*--------------------------------------------------------------------*/ public String updateSecretQuestion(){ try{ em.merge(secretQuestions); setMode(0); getSecretQuestionsList(); acknowledge = "The record is updated successfully"; }catch(org.hibernate.validator.InvalidStateException e){ System.out.println(e.getMessage()); System.out.println("error..."); InvalidValue[] val=e.getInvalidValues(); for(int i=0;i<val.length;i++){ System.out.println(val.getPropertyName()); } } return "successUpdate"; } /*--------------------------------------------------------------------*/ public String showSecretQuestionDetails(){ try{ setMode(1); acknowledge = null; secretQuestions = em.find(SecretQuestions.class, selectedSecretQuestion.getId()); }catch(Exception e){ setMode(0); System.out.println("Error Have accoured in\n\t SecretQuestionAction.java --> showSecretQuestionDetails()? \n\t"+e.getMessage()); } return "/secretquestions_crud.jsp"; } /*--------------------------------------------------------------------*/ public String loadSecretQuestion(){ System.out.println("in the getPricingOption method load"); try{ setMode(2); acknowledge = null; secretQuestions = em.find(SecretQuestions.class, selectedSecretQuestion.getId()); }catch(Exception e){ setMode(0); System.out.println("Error Have accoured in\n\t SecretQuestionAction.java --> loadSecretQuestion()? \n\t"+e.getMessage()); } return "/secretquestions_crud.jsp"; } /*--------------------------------------------------------------------*/ public String toCreateForm(){ acknowledge = null; resetMode(); return "/secretquestions_crud.jsp"; } /*--------------------------------------------------------------------*/ public void resetMode(){ try{ if(secretQuestions != null){ setMode(0); secretQuestions=null; sessionContext.remove("SecretQuestions"); acknowledge = null; } }catch(Exception e){ System.out.println("Error Have accoured in\n\t SecretQuestionAction.java --> reSetMode()? \n\t"+e.getMessage()); } } /*--------------------------------------------------------------------*/ public int getMode() { return mode; } public void setMode(int mode) { this.mode = mode; } /*--------------------------------------------------------------------*/ public String getAcknowledge() { return acknowledge; } public void setAcknowledge(String acknowledge) { this.acknowledge = acknowledge; } /*--------------------------------------------------------------------*/ @Remove @Destroy public void destroy(){} /*--------------------------------------------------------------------*/ } View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996576#3996576 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996576 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user