Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Having problems with QueryString parameters with simple IFs  RSS feed

 
willie wright
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there a better way to do this because my IF statement is not working:

URL: http://localhost:8080/test.jsp?gender=M


 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "it is not working"?
Do you consider use JSTL instead of Java snippets in your JSPs?
 
willie wright
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean it is always hitting the else portion of the IF statement even though the condition is met.

Yes, I have considered JSTL. This is my first Java project. I would like to look into JSTL before I "wrap" the project in a servlet.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Java == does not compare values; it tests for identity. Use the equals() method to test for equality.

If this is your first project, start out on the right foot and do not learn the bad habit of putting Java code in a JSP.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:In Java == does not compare values; it tests for identity. Use the equals() method to test for equality.

I missed that as I have been working extensively with Groovy and Scala lately.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!