There are several ways to handle this, maybe too many options:
>From a view controller:
String userName = getBean("sessionScope.userName");
Or, create a managed bean with the parameter like a Struts form bean:
<managed-bean>
<managed-bean-name>userParms</managed-bean-name>
<managed-bean-class>myobject</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>userName</property-name>
<value>#{sessionScope.userName}</value>
</managed-property>
<managed-bean/>
myobject object = (myobject) getBean("userParam");
Or, if you like the Struts dyna form:
<managed-bean>
<managed-bean-name>userParms</managed-bean-name>
<managed-bean-class>java.util.TreeMap</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<list-entries>
<key-class>java.lang.String</key-class>
<value-class>java.lang.String</value-class>
<map-entry>
<key>userName</key>
<value>#{sessionScope.userName}</value>
<map-entry>
</list-entries>
<managed-bean/>
myparms Map = (Map) getBean("userParam");
Gary
--- Begin Message ---
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
--- End Message ---
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]