Couldn't help modifying this!

Let us avoid
if (someBooleanExpression) {
        someVal = true;
} else {
        someVal = false;
}

try instead to write
someVal = someBooleanExpression;

So:
boolean isNetscape = userAgent.toLowerCase().indexOf("msie") == -1 &&
        userAgent.toLowerCase().indexOf("spoofer") == -1;

Rajinder Sandhu wrote:

> <%@ import="java.io.*,java.util.*,java.lang.Object,java.text.Format" %>
>
> <%
> // using Java, determine if the browser is Netscape or MSIE
> boolean isNetscape = false;
>
> String userAgent = request.getHeader("User-Agent");
> if ( userAgent.toLowerCase().indexOf("msie") ==-1   &&
> userAgent.toLowerCase().indexOf("spoofer")==-1 )
> {
>    isNetscape = true; // browser is Netscape
> }
> else
> {
>    isNetscape = false; // browser is NOT Netscape
> }
> %>
>
>

--
Ashish Shrestha
Gha 2-482, Balajutar, Kathmandu, Nepal
Phone: 977-1-350593.

===========================================================================
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to