* - when my webapp is deployed in Weblogic server 10
Hello good folks
Pls. refer to my code below. Why am I always getting a new session with this code? anything wrong with it? It runs ok in tomcat - no new sessions everytime. In WLS, new session every form submit...sigh...what to do ...pls help
-------------------------
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String title = request.getParameter("subject");
String strTimeStr = request.getParameter("starttime");
int startTime = Integer.parseInt(strTimeStr);
String endTimeStr = request.getParameter("endtime");
int endTime = Integer.parseInt(endTimeStr);
String[] days = request.getParameterValues("day");
HttpSession sess = request.getSession(true);
SchoolSchedule sched = (SchoolSchedule) sess.getAttribute("sched");
if (days != null){
for (int i=0;i<days.length;i++){
String dayString = days[i];
int day;
if(dayString.equalsIgnoreCase("SUN")) day = 0;
else if(dayString.equalsIgnoreCase("MON")) day = 1;
else if(dayString.equalsIgnoreCase("TUE")) day = 2;
else if(dayString.equalsIgnoreCase("WED")) day = 3;
else if(dayString.equalsIgnoreCase("THU")) day = 4;
else if(dayString.equalsIgnoreCase("FRI")) day = 5;
else day = 6;
SchoolClass clazz = new SchoolClass(title, startTime,endTime, day);
sched.addClass(clazz);
}
}
request.getSession().setAttribute("sched", sched);
getServletContext().getRequestDispatcher("/Schedule.jsp").forward(request, response);
}
-------------------------
I added a few more lines in my servlet and I've noticed that for the WLS deployment, I ALWAYS get a new session when I click the form submit button. That's why the stuff that should've been save in the session from the previous form submit is missing.
I only have two elements in my webapp, a jsp page and a servlet. The jsp page has 2 sections, one for getting user inputs and the other part for displaying it. The servlet gets the data inputted in the jsp, massages this data and adds it to an attribute in the session object. The proper thing would be for the data to persist in the session attributes - but it's not behaving like this.
appreciate any suggestions. ^_^
Hello good folks
Pls. refer to my code below. Why am I always getting a new session with this code? anything wrong with it? It runs ok in tomcat - no new sessions everytime. In WLS, new session every form submit...sigh...what to do ...pls help
-------------------------
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String title = request.getParameter("subject");
String strTimeStr = request.getParameter("starttime");
int startTime = Integer.parseInt(strTimeStr);
String endTimeStr = request.getParameter("endtime");
int endTime = Integer.parseInt(endTimeStr);
String[] days = request.getParameterValues("day");
HttpSession sess = request.getSession(true);
SchoolSchedule sched = (SchoolSchedule) sess.getAttribute("sched");
if (days != null){
for (int i=0;i<days.length;i++){
String dayString = days[i];
int day;
if(dayString.equalsIgnoreCase("SUN")) day = 0;
else if(dayString.equalsIgnoreCase("MON")) day = 1;
else if(dayString.equalsIgnoreCase("TUE")) day = 2;
else if(dayString.equalsIgnoreCase("WED")) day = 3;
else if(dayString.equalsIgnoreCase("THU")) day = 4;
else if(dayString.equalsIgnoreCase("FRI")) day = 5;
else day = 6;
SchoolClass clazz = new SchoolClass(title, startTime,endTime, day);
sched.addClass(clazz);
}
}
request.getSession().setAttribute("sched", sched);
getServletContext().getRequestDispatcher("/Schedule.jsp").forward(request, response);
}
-------------------------
I added a few more lines in my servlet and I've noticed that for the WLS deployment, I ALWAYS get a new session when I click the form submit button. That's why the stuff that should've been save in the session from the previous form submit is missing.
I only have two elements in my webapp, a jsp page and a servlet. The jsp page has 2 sections, one for getting user inputs and the other part for displaying it. The servlet gets the data inputted in the jsp, massages this data and adds it to an attribute in the session object. The proper thing would be for the data to persist in the session attributes - but it's not behaving like this.
appreciate any suggestions. ^_^