How to get a session variable value in server side in java


my requirement is mutiple calendar view. A user who logs in have an individual calendar.The user’s Id is set in a session variable named ‘userId’ ( eg. session.setAttributte(“userId”,“Maera”) ) .

The user wish to make an appointment in a doctor calendar for consultation.

The user adds an appointment (event) in doctor’s calendar scheduler. How can i get session variable value in server side.

The insert/update/delete database operation gets worked by the render_sql("","","") function. so during insertion/updation/deletion i should get the 'userId ’ session value to do database operations.

How to get this session variable value in server side in java class? Or is there any method to get a userId value in server side during insertion/updation/deletion db opertion?

thank you


You can override doGet method of connector class, to get access to the session

public class Scheduler_BasicConnector extends ConnectorServlet {
private String userId;

/* (non-Javadoc)
* @see com.dhtmlx.connector.ConnectorServlet#configure()
protected void configure() {
Connection conn= ( new DataBaseConnection()).getConnection();
SchedulerConnector c = new SchedulerConnector(conn);

public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
userId = (String)req.getSession().getAttribute(“userId”);
super.doGet(req, res);

hi ,

How to get this session variable 'userId ’ value in all the class. i want to update an event  already added in a table with this ’ userId ’

In  Scheduler_RecBehavior  ,inside  beforeProcessing(DataAction action) function how can i get this session variable 'userId value to perform the below mentioned updation operation.

update event_rec set text=“value” where event_pid="+action.getId()+" and userId="+userId;

To get the session attribute value, we should have a request object.

how is it possible?

thank you