because you declare you variable in an if statement. It is out of scope when you call 
it outside the if.

>>> Alex Nguyen <[EMAIL PROTECTED]> 07/17/01 12:55PM >>>
Can anyone tell me why this

<
String strHeader = request.getHeader("referer");
String strCompare = "http://test.com;
out.println(strHeader);
if (strHeader.equals(strCompare))
{
 String strOutput = "http://www.amazon.com/;
}
else {
String strOutput = "http://www.bn.com/;
}
>

<br>
<center>
<font color=#ffffff face="arial,verdana" size=1>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=strOutput%>home.php">Home</a>


gets this error:

500 Servlet Exception
/Alex/footer.jsp:18: Undefined variable: strOutput
 out.print((strOutput));
 ^
1 error


Resin 2.0.1 (built Tue Jul 10 13:13:19 PDT 2001)



Thanks.

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