Hi,
Please excuse the naiveté of my question as I am knew to JSP/servlets.
Is it possible to refer to the session & response objects from inside <%!
declaration %> statements? As such:
<%!
public void CheckPassword(String strPass) {
if (strPass.length() < 1 ) {
session.setAttribute("ErrorMessage",
"The password field is empty");
response.sendRedirect("error_message.jsp");
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Check personal details</title>
</head>
<body>
<%
CheckPassword((String)request.getParameter("password1"));
%>
</body>
</html>
I keep receiving the following errors:
Undefined variable or class name: session
session.setAttribute("ErrorMessage", "The password field is
empty");
Undefined variable or class name: response
response.sendRedirect("error_message.jsp");
Thanks in advance.
Regards,
Pete
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets