I am having problem while retrieving session attributes in servlet
called via ajax
cal.
$('#homemainSearchField').submit(function(){
$.get("./CheckNoOfSearch",function(data){
checkLimitation(data);
});
});
In CheckNoOfSearch
servlet
i am trying to retrieve some session attributes, but all session attributes are null but its not that i haven't set it.
The servlet code is
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
HttpSession session = request.getSession();
int noOfSearch = 0;
if (session.getAttribute("auth") != null && session.getAttribute("type") != null) {
System.out.println("Session found");
}
out.print(noOfSearch);
} finally {
out.close();
}
}