• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

What if the value is null and the var does not exist in the particular scope for c : set?

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


Above is copied from bert's book.

Now let us imagine that value is null.
And the attribute "userLevel" does not exist.

What happens?

I know that if the value is null, then the var is removed from the scope. If the scope is default then it starts looking at page scope, then request, then session , then..

And if the var does not exist, then it is created in the scope specified and if no scope specified then on default page scope.

What if the value is null and the var does not exist in the particular scope?
 
Creator of Enthuware JWS+ V6
Posts: 3348
303
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swagato,

Nothing happens, no error occurs, and no variable is created in scope with that name. You can verify it with the following code:

and it outputs: beestje waardeJN
("waardeJN" was put in the session by my servlet, "beestje" was printed to show that param.aapje doesn't contain any value)

Regards,
Frits
 
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic