Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cookie code...

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

the code displays JavaUser in my textbox.
And It does'nt save the uid i enter and submit. Every time I refresh it displays JavaUser as the value. From where is this JavaUser coming. I don't understand.. along with this I get NullPointerException. Please correct my code. and help me.
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all by the cookie of JavaUser, you are running this under the servlet runner program that Sun provides, it always sets a cookie to this. That explains why it says that by your code. The null pointer is comming from the second call to response.setContentType("text/html"); it's done after the call to PrintWriter out = response.getWriter(); this call invalidates (sets to null) the HttpServletResponse object.
If you want the uid that they type in first of all remove the second call to response.setContentType("text/html"); then change the if statement to
if(name != null)
)
out.println("<input type = text name = uid value = " + name + ">" );
{
else ...
this should correct your problems!

[This message has been edited by Carl Trusiak (edited June 16, 2000).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic