Hi,

Instead of using "else if(interest == "Procedures ")" try using the
following "else if(interest.equals("Procedures")".
because req.getParameter returns a String. To check whether this string is
either "Procedures" or "Maps" you've to use  ".equals".
I hope this works fine. Let me know the result.

Bye.




>From: "Jeffrey L. Watson" <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>        Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Parameter
>Date: Mon, 14 Jun 1999 15:48:18 -0400
>
>I want to evaluate a parameter called "interest" and build dynamic HTML
>content based on it's value.  When I write the value of "interest" back out
>to the web page it seems to have the correct parameter value.  Lets say if
>called with ?interest=Maps then it writes out to the web page "Maps".
>However, when I try to make a comparison between "interest" and a String as
>in the code below, it doesn't work if interest equals anything other than
>"".
>
>For example:
>
>     http://server/servlet/dynamic
>     This returns the content built in buildDefault()
>
>     http://server/servlet/dynamic?interest=Maps
>     Doesn't return any content at all.
>
>
>// get initialization parameters
>   if (req.getParameter("interest") != null) {
>       interest = req.getParameter("interest");
>   }
>   else {
>       interest = "";
>   }
>
>// build dynamic content
>   if(interest == "") {
>       out.println(buildDefault());
>   }
>   else if(interest == "Procedures ") {
>       out.println(buildProcedures());
>   }
>   else if(interest == "Cafeteria") {
>       out.println(buildCafeteria());
>   }
>   else if(interest == "Maps") {
>       out.println(buildMaps());
>   }
>
>Thanks!
>
>Jeff
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to