• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I had these two jsp interview questions

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I had an interview yesterday and they give me this question, I could not find a solution :

1)Question1:

The following code loops through a collection of HighlightEntities and writes out a list. If there are no highlights then it should write out “No highlights,” but it is possible for the page to display neither highlights nor the “No highlights” message, but not cause an error. Why?



2)Question2:

A filter sets an attribute, “newsList”, on the request before this file is served. “newsList” is an arrayList of NewsEntity objects. The result should be an XML listing of NewsEntities.

What is wrong with this JSTL code?




thanks, your help is appreciated.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hint:you have done the null check(list==null). well, there is also one more check called *empty check* .
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

majid nakit wrote:
What is wrong with this JSTL code?


what is your opinion? and please start a new thread/topic for a new question.
 
Greenhorn
Posts: 1
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at this and try to use
https://coderanch.com/t/412438/java/java/if-isEmpty-or-null

  • The list is completely empty
    The list does not exist.


  • Try checking if isEmpty instead of using null
     
    reply
      Bookmark Topic Watch Topic
    • New Topic