| Author |
Conditions on field
|
Mike Jenkins
Ranch Hand
Joined: Jul 23, 2006
Posts: 57
|
|
I am processing form values using Enumeration class in a JSP and would like to know how to deal with fieldnames I dont want. In the below I dont want to display FieldA but the output shows it even when I try and write condition for it: Output: FieldCC FieldA OtherField aField ..more fields etc.. The FieldA should not output.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56200
|
|
Is this the right way to do String comparisons in Java?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Mike Jenkins
Ranch Hand
Joined: Jul 23, 2006
Posts: 57
|
|
|
I am not sure how would I do String comparison?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56200
|
|
Are you new to Java? In Java, the == operator (and its relations like !=) is a test for identity, not for equality. It asks, "are these objects the same?". It does not ask "do these objects have the same value?" For that, you need to use the equals() method of String. [ March 02, 2007: Message edited by: Bear Bibeault ]
|
 |
Mike Jenkins
Ranch Hand
Joined: Jul 23, 2006
Posts: 57
|
|
Thanks for quick reply! I tried this and it still not working: It still outputs: Output: FieldCC FieldA OtherField aField ..more fields etc.. [ March 02, 2007: Message edited by: Mike Jenkins ]
|
 |
Mike Jenkins
Ranch Hand
Joined: Jul 23, 2006
Posts: 57
|
|
Sorry to take your time. It did work: I had a misspelling. I printed the article about the equals() method and I appreciate your reponses and time! [ March 02, 2007: Message edited by: Mike Jenkins ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56200
|
|
No problem, it's what Javaranch is for. I'd strongly suggest beefing up your Java skills before delving much more deeply into JSP. You'll find that time well spent.
|
 |
 |
|
|
subject: Conditions on field
|
|
|