• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Accessing Environment Variable

 
Ranch Hand
Posts: 838
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 67748
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic