[SOLVED]: How to maintain session through a DirectAction call
[SOLVED]: How to maintain session through a DirectAction call
- Subject: [SOLVED]: How to maintain session through a DirectAction call
- From: Baiss Eric Magnusson <email@hidden>
- Date: Thu, 31 Mar 2005 17:59:14 -0800
Did 2 things:
1) Added in the DA method below
Session session = (Session)existingSession();
2) Moved the following code from Main's Constructor to the <awake>
method:
if ( hasSession() ) {
session = (Session)session();
ec = session.defaultEditingContext();
user = session.getUser();
loginLevel = user.loginLevel().intValue();
} else {
loginLevel = 0;
ec = new EOEditingContext();
}
I have created the Main page so that it's widgets all invoke
DirectActions, but now I <logIn> while in Main and all is fine, the
Main page shows things that weren't available when not logged in.
However, if you then use one of the widgets the page refreshes and it
has lost session information.
Here's the DirectAction method for the previous month button.
public WOActionResults prevMonthAction() {
String anID = getSessionIDForRequest( request() );
String month = request().stringFormValueForKey("curentMonthNum");
String year = request().stringFormValueForKey("curentYearNum");
int offset = calculateOffset( month, year );
Main main = (Main)pageWithName("Main");
main.setMonth( offset - 1 );
if ( anID != null ) { // if anID is not null there was a session
around when the DA was called
Session session = (Session)existingSession();
***************** what can I do here so that Main will maintain
session **************** }
return main;
}
----
Baiss Eric Magnusson
<http://www.Track-Your-Finances.com>
<http://www.CascadeWebDesign.com>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden