我在我的java代碼中遇到了會話問題。通過郵件提交表單後,java servlet將確定驗證碼是否正確。我可以知道我應該添加什麼來使用java servlet中的會話嗎?有什麼我需要導入使用會話嗎?如何在Java Servlet中使用會話?
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try{
// Validate Captcha
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) {
...
}
...
非常感謝。
請給出更多細節。特別是,「我有問題」非常模糊 - 請解釋你所看到的。 – 2010-01-11 08:19:14