This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes HTTP Status 500 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Status 500 " Watch "HTTP Status 500 " New topic
Author

HTTP Status 500

tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
this is what i got when i tried to pass servlet data to the same servlet.

output at browser :



servlet code :


is there a error in transferring the data from the servlet to itself

Do Right , Fear No Man
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

Not a Tomcat question. Moved to the Servlets forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

Here's the important part:
java.lang.NullPointerException
auction.doPost(auction.java:21)
tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
Bear Bibeault wrote:
auction.doPost(auction.java:21)


line 21 is :
if(itemid.trim().equals(""))

and i don't think there is an error here


entire code is :



my purpose of writing this program is to transfer form data to servlet and if any data is not filled ,it is asked again to do so,
but the problem is i am unable to transfer the servlet data to the same servlet .

Charbel Keyrouz
Ranch Hand

Joined: Jun 10, 2005
Posts: 46
are you sure that the itemid is not null?

You should change your tests to take into consideration the null values.
tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
Charbel Keyrouz wrote:are you sure that the itemid is not null?

You should change your tests to take into consideration the null values.


yeah i took null and got the result , but what't the difference between null and blank("")

cheers
Tushar
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

There is a huge difference between both.

Think of strings as an object.

so "", is also an Object in memory. it has properties such as length, etc.

now lets look at null, Its a Black hole, not even light can accept it.

a null is a reference thats initialised to nothing [pardon my non technical grammer here]
rather it "refers" to nothing.

consider the diff between:




and


and



My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HTTP Status 500
 
Similar Threads
Servlet becomming slow
Hi 'm strugling lot to run a simple hello world prgm
Servlet becomming slow
servlet exception occurs at "dispatcher.forward()"
http error?