No, unless you pass it as a parameter to the functions defined in the
declaration section, you can't use it.
----- Mensaje Original -----
De: Peter Bishop <[EMAIL PROTECTED]>
Fecha: Viernes, Enero 12, 2001 9:27 pm
Asunto: response & session access from Declarations
> 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
>
________________________________________________________________
Aprovechamos este mensaje para desearte una FELIZ NAVIDAD.
Entra en http://www.navidad.navegalia.com/ y descubre las sorpresas que
Navegalia tiene para esta Navidad.
===========================================================================
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