Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I had these two jsp interview questions

 
majid nakit
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • 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.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • 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 Java Windows XP
  • Mark post as helpful
  • send pies
  • 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.
 
Hosea Kandie
Greenhorn
Posts: 1
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at this and try to use
http://www.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
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic