• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.NullPointerException in Opening JSP fle  RSS feed

 
Ramakanta Sahoo
Ranch Hand
Posts: 256
Fedora Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm getting below error on my Tomcat 5.0.28 while accessing a JSP page(input.jsp) which has below code
Why this error comes. It was all fine some times back and on a sudden it failed.
what could be the reason.

ERROR:


 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
144
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First question is why you are still putting Java scriptlets in JSP pages? That's a practice that is about 6 years out of date at this point.

Your form should be submitting to a servlet controller when your form can be processed and there should be no Java in the JSP.

Even using old-fashioned scriptlets, it's also very strange to have the form processing code in the same JSP as the form. The code will execute before the form even gets sent to the browser for the user to fill in. What sense does that make?
 
Ramakanta Sahoo
Ranch Hand
Posts: 256
Fedora Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Bear,
I am very new to JSP I will take your point and will try it.
Any further suggestions are also appreciated.
I will sure take it seriously
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear's response contains the information necessary to understand where the NPE's are coming from.

As to why it started to fail, that's hard to say w/o knowing the history of the source: I find it *very* unlikely that the source as presented here *ever* worked--it will always fail when the page is first loaded, before a submit (to the same JSP). (That's another hint.)

I'm curious--code like this would never have survived even a minimal code review anywhere I've worked; is this production code? How has it been tested, and is there an automated testing process in use where the code is developed?
 
Ramakanta Sahoo
Ranch Hand
Posts: 256
Fedora Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnks David,

Dont be afraid Its just a test JSP. its no where tested I was just playing around
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!