由于本人欠考虑,导致使用session的工具类出现错误,在此将修正的代码重贴(在此表示歉意):
package com.fujitsu.eFrame.eftool;
import javax.servlet.http.HttpSession;
import com.fujitsu.uji.DispatchContext;
import com.fujitsu.uji.http.HttpSessionProfile;
public class SessionUtil {
private static HttpSession getSession(DispatchContext context) {
return ((HttpSessionProfile)context.getSessionProfile()).getSession();
}
public static Object getAttribute(DispatchContext context, String name) {
try {
return getSession(context).getAttribute(name);
} catch (IllegalStateException ex){
return null;
}
}
public static void setAttribute(DispatchContext context, String name, Object value) {
getSession(context).setAttribute(name, value);
}
public static void setTimeout(DispatchContext context, int seconds) {
getSession(context).setMaxInactiveInterval(seconds);
}
}