Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7921807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:43:22+00:00 2026-06-03T16:43:22+00:00

Im trying to access the example/web folder (see below in the image) in a

  • 0

Im trying to access the example/web folder (see below in the image) in a jsf managed bean but cant seem to find a way to do it

Im trying to access the **example/web** folder (see below in the image) in a jsf managed bean but cant seem to find a way to do it

thx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:43:25+00:00Added an answer on June 3, 2026 at 4:43 pm

    If you want to get it as a File for some reason, then you need ExternalContext#getRealPath(). This converts a relative web path to an absolute disk file system. Since you need the web’s root folder, just pass in /:

    String absoluteWebPath = externalContext.getRealPath("/");
    File webRoot = new File(absoluteWebPath);
    // ...
    

    Unrelated to the concrete problem, whatever functional requirement you’ve had in mind for which you thought that having an absolute local disk file system path to the web folder is the right solution, it has most definitely to be solved differently. And indeed, as per your comment on the other answer,

    because Im trying to upload some file inside the folder and using the relative path

    you’re going the wrong path. You should not store uploaded files in there if you intend to keep them longer than the webapp’s deployment lifetime. Whenever you redeploy the webapp (and on some server configs even when you restart the server), the uploaded files would get completely lost, simply because they are not contained as part of the original WAR file. Even more, some heavy server configs don’t expand the WAR on disk at all, but in memory instead, the getRealPath() would then always return null.

    Rather store it in a fixed disk file system path outside the server’s deploy folder. Add that path in turn as a new server context or docroot, so that it’s accessible on a different (virtual) context path. Or homegrow a servlet which gets an InputStream of it from disk and writes it to OutputStream of the response. See also this related answer: Uploaded image only available after refreshing the page

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the example below I'm trying to access the parents sibling. Is there a
I'm trying to access a member structs variables, but I can't seem to get
I am trying to access a web service using NSURConnection, but i am not
I'm trying to access $a using the following example: df<-data.frame(a=c(x,x,y,y),b=c(1,2,3,4)) > df a b
I'm trying to access the post target action in a jquery function. example: <form
I'm trying to write an application server using Happstack, Heist, and web-routes, but am
I have a WPF web app and Im trying to access a SQL 2000
I am basically trying to access the network share resources from my Web Application
I'm getting a SecurityException, Access Denied when trying to make a web.config modification programmatically.
I am trying to access a web API using a POST technique. I AM

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.