aspose file tools
The moose likes JSP and the fly likes Conditions on field Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Conditions on field" Watch "Conditions on field" New topic
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
    
  13



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
    
  13

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
    
  13

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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Conditions on field
 
Similar Threads
hi, i have an array question, this is probably really obvious (to everyone else other than me)
topological sort
how to load on startup and get an instance of class?
Appending row to end of JTable
Assigning a java class to an identical one with different namespace