aspose file tools*
The moose likes Servlets and the fly likes Possible to set an env-entry to null in my web.xml file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Possible to set an env-entry to null in my web.xml file?" Watch "Possible to set an env-entry to null in my web.xml file?" New topic
Author

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

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
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

Joined: Jan 10, 2002
Posts: 60072
    
  65

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.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
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

Joined: Jan 10, 2002
Posts: 60072
    
  65

See the first word of my reply.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Possible to set an env-entry to null in my web.xml file?
 
Similar Threads
getInitParameter with a MessageDrivenBean
How do you access [env-entry] values in web.xml from Java code?
Getting "Lookup Error Name comp/env/mail not found in context "java:"." error
Open crystal report in JSP
value for Context.PROVIDER_URL