This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
    Bookmark Topic Watch Topic
  • New Topic

setting background color  RSS feed

 
Ricky James
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello,

I am writing a simple JSP page in which the user enters the color that she wants for background and on submission the color is displayed in the background. I want to modify the code so that if the user hits submit without entering anything, then the color should be blue.

My attempt is below. Can somebody please advise where I am wrong as at the moment if I leave the field blank then it displays white background.

Thanks
Ricky

 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Report post to moderator
If you don't specify anything in a form parameter, you get an empty string (and NOT null). So your check should be:
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not psot the same question more than once.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!