• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

NullPointerException in HttpServletResponse  RSS feed

 
Ranch Hand
Posts: 103
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm needing to send a msg to my jsp if the condition is false. I have a servlet with a method to do this, below is my method. In this servlet class I have many other method like to write in db, read from db and much more.

The error are in line 28.
Thanks in advance.
 
Master Rancher
Posts: 4042
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Cezar Apulchro wrote:Hi,
I'm needing to send a msg to my jsp if the condition is false. I have a servlet with a method to do this, below is my method. In this servlet class I have many other method like to write in db, read from db and much more.



Re: the bit in bold.  That implies that you ought to have a service that handles all this sort of thing.
The servlet ought to be acting as a coordinator between the front end (the JSP/browser) and the back end (the services).

Anyway, as for your problem, what is this chunk of code supposed to be doing?

 
Cezar Apulchro
Ranch Hand
Posts: 103
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what i need with this code is to show an jsp of error.
 
Sheriff
Posts: 21719
102
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code doesn't have a request or a response. It has variables of the correct types, but these are null because that's the value you give them. What you (probably) should do instead is change the method to take arguments for the request and response, and call it from your doGet / doPost method.

Note that it's probably not a good idea to continue with your method (return a value) after you've forwarded your request.
 
Cezar Apulchro
Ranch Hand
Posts: 103
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
problem is solved. I put my response into my doPost.

Thanks
 
I've never won anything before. Not even a tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!