Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
    Bookmark Topic Watch Topic
  • New Topic

setting background color

 
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: 65537
108
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.
 
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!