I'm having session problems in my java code. After submitting the form via mail, the java servlet will determine if it is converted correctly. Can I find out something I need to add in order to use a session in a Java servlet? Is there something I need to import to use the session?
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try{
String userCaptcha = request.getParameter("captcha");
Captcha captcha = (Captcha) session.getAttribute(Captcha.NAME);
if (!captcha.isCorrect(userCaptcha)) {
errorMsgs.add("Please input the correct Captcha value.");
}
} catch (RuntimeException e) {
...
}
...
Many thanks.
source
share