Hi all:

I am making small and halting progress with my Shale application and have 
this pretty fundamental question. Suppose my backing bean has this code:

public String getWorkList() {

        String username = (String) FacesContext.getCurrentInstance()
 .getExternalContext().getSessionMap()
                                        .get(Constants.userKey);
        String password = (String) FacesContext.getCurrentInstance()
 .getExternalContext().getSessionMap().get(Constants.pwKey);
        if ((username == null) || (password == null))
                return "loggedOff";
        ..etc.

I can see myself doing this check many times in many methods in many 
backing beans (which extend AbstractViewController). What is the 
appropriate way to implement this check - or for that matter any other 
common code? I can of course extend AbstractViewController and write this 
method there and all my beans can call it... but I kind of think there 
must be a better way..? (Something like Struts' RequestProcessor..) I 
thought perhaps this may be where preprocess() can come in handy - 
however, that method returns void. Plus it is within each backing bean and 
not common to all backing beans..

Thanks in advance,
Geeta

Reply via email to