• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

having trouble checking for null value of attriibute in jsp

 
Susan Monz
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting the foolowing error on my jsp because of code I have written within my scriptlet tag

Error Message: null

java.lang.NullPointerException
at _web_2d_inf._jsp._page._PagePrint._jspService(PagePrint.jsp:109)

The code is
<% if(((Number) vo.getCurrentRow().getAttribute("PageCode")).intValue() == 0){%>

I tried checking it against null and "" still threw me error. PageCode can be null. If it is null i have set some other attributes. but how do i check for null.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Either vo, the current row, or the current row's "PageCode" attribute is null--it'll be hard to help without knowing which is null!

Dave
 
Susan Monz
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying.

Actually i do a check to make sure vo is not empty

if (vo.getRowCount() > 0) {
vo.setCurrentRow(vo.first());
}
And with my debugger I know it sets the currentRow.

PageCode is null. It is for this condition I want to code further...
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Susan Monz:
Thanks for replying.


PageCode is null. It is for this condition I want to code further...


If you have a doubt about 'PageCode' is null or not , then check for it , like

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic