Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Possible to set an env-entry to null in my web.xml file?

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using JBoss 5.1, Java 1.6 on Mac 10.5.6. I have a web application and I was wondering if it possible to set an env-entry to null? Currently I have this in my web.xml file ...



But with this set up, looking up "my.entry" in the context returns an empty string, and I would prefer it to return null. I also don't want to remove the env-entry because then I will get a NameNotFoundException if try and look up my.entry.

Thanks for any ideas you might have, - Dave
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Either deal with the empty string (how hard is it to test for the empty string and replace it with null if that's what you want?), or catch the exception and use it to set the value to null.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would love to implement one of your suggestions but I'm dealing with code that is not my own and it requires that I get a null value in for the environment entry. I know this is a hard question, but is it possible to do what I'm asking? If not, just let me know.

Thanks, -
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the first word of my reply.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic