• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm good, String here is an Object
 
Dinesh Remje
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Shankar,
Ya got it now very clearly.
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Onion rings are vegetable donuts. Taste this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic