Saturday 6 October 2012

How to use session in Java web Project

Creating / Using session : Java Web Project



// NameSpace imports
import java.util.Map;
import com.opensymphony.xwork2.ActionContext;
/* Use openSymphony .jar for above import
//Declaration of Session
private Map session;
//Create setter getter
session = ActionContext.getContext().getSession();
//Use session.put & session.get
session.put(“Id”,userID );
String userId = (String)session.get(“Id”);

No comments:

Post a Comment