• 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

JSP page with Bean throws : NullPointerException

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I use a jsp page with beans and receiving a NullPointerException when I call the page. It behaves like my bean ("localityJDBCTemplate") is not initialized. I thought it was done here :


Relevant lines from my code are below.

Example.jsp :

Beans.xml :



 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think Spring beans are stored in HttpSession as attributes. Still you can try by adding session scope to your Spring bean, something like this:


I don't think this will work either but you can give it a try. Also I don't understand why you want to create a JdbcTemplate as a session bean. To make this work you might have to write a SessionListener and set the Spring beans as HttpSession attributes in that listener class...
reply
    Bookmark Topic Watch Topic
  • New Topic