The correct syntax is:
    reponse.sendRedirect(url);

where url is of Java type String...

U need to recode your statements to:
 String url = "login2.jsp";
If URLRewriting is used, the use response.encodeRedirectURL method on ur url
string before sending it as a parameter to sendRedirect method....

Make sure the targetted file is in the correct directory...






----- Original Message -----
From: "sufi malak" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 28, 2001 12:48 AM
Subject: sendRedirect ??


> I got this error :
> A Servlet Exception Has Occurred
> org.apache.jasper.JasperException: Unable to compile class for
>
JSP..\work\localhost\ultra2\_0002flogin_00032_0002ejsplogin2_jsp_1.java:89:
> Undefined variable or class name: Insert
>                 response.sendRedirect(Insert.jsp);
>                                       ^
> ..\work\localhost\ultra2\_0002flogin_00032_0002ejsplogin2_jsp_1.java:92:
> Undefined variable or class name: login2
>                 response.sendRedirect(login2.jsp);
>                                       ^
> 2 errors
>
>
> This is my code for login2.jsp :
> <%@ page import="Employee"%>
> <jsp:useBean id="employee" class="Employee" scope="request"/>
> <%
> String  user = (String)request.getParameter("username");
> String  pass = (String)request.getParameter("password");
> // check the session first, if the user is in the session
> sendRedirect(Insert.jsp) directly
> if (user != null && pass != null)
> {
> if (employee.login(user, pass)){
> System.out.println("user exists");
> response.sendRedirect(Insert.jsp);
> }
> else
> {
> System.out.println("User does not exist");
> response.sendRedirect(login2.jsp);
> }
> }
> %>
>
> Thanks
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
===========================================================================
> 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

===========================================================================
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

Reply via email to