aspose file tools
The moose likes JSP and the fly likes Accessing Environment Variable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Accessing Environment Variable" Watch "Accessing Environment Variable" New topic
Author

Accessing Environment Variable

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 788
I guess the subject says it all. How can I access an environment variable in JSP? For example, I'm looking to find out what the current program running is called (i.e. myTestPage.jsp is what I would like returned or even the full URL path as displayed in the browser). Thanks so much.

Rob
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56204
    
  13

Java has no means to detect environment variables. Besides, what env var is going to tell you the name of the JSP?

What is it you are really trying to do? Current URL info is available from the HttpServletRequest.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Kevin Alterman
Greenhorn

Joined: May 21, 2005
Posts: 12
When you say "environment" variable what exactly do you mean? Are you talking about Operating System Environment variables? Those are not accessible since your Java App is running the context of the JVM.

You can pass an OS environment variable to a java program is through a command line argument to the program
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Accessing Environment Variable
 
Similar Threads
QUERY INSTALLING XERCES-2.6.2 with JSDK1.4
Not able to find .dll file in my java path
why don't i get the command prompt back when I run my java program from the terminal window?
Help I can't figure out how to install java jdk 7
question on package and classpath