• Post Reply Bookmark Topic Watch Topic
  • New Topic

How view of Table can be control with the help of Array Elements

 
Dinesh Remje
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In the above code String Array contains Named "headname" contains varios elements like "Name, Mobile, College" etc.
Now i am using if loop in scriplet inorder to control the view of table.
Now in "headname[0]" there is a "Name" element. Now i have written a loop that if it matches, then the column name "Name" should be displayed or else it should ignore it and display all other columns. But i am not able to get. Even though there is "Name" element in "headname[0]" position then to it runs the later case.
So what should i do.
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi dinesh,
please do a string compare not like --> headname[0]!="Name"
do it like this String.valueOf(headname[0]).equals("Name"))

if this doent work then we shall see what is the actual problem
 
Dinesh Remje
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Shankar,

Thanks, Ya now it started working. But can you tell me why cant we compare the String values as i was doing early.
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm good, String here is an Object
 
Dinesh Remje
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Shankar,
Ya got it now very clearly.
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dinesh, today i have seen similar post (same code) somewhere in a different section, looks like same code, thinking that you have posted it... The same solution may apply there as well.
(I remember someone asking you to close brace in 'if' statement). If it is not you, please ignore this.

Additionally, Use Expression language instead of scriplets..
Have fun with jAva
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!