简体   繁体   中英

How to access welcome files on running web dynamic project in java which are stored in remote location?

In web.xml

<welcome-file>file:C:/Users/abc/Desktop/Design Pages/index.html</welcome-file>
<welcome-file>index.htm</welcome-file>

I want to access file from my local drive not from classpath in eclise project.

Welcome files, if specified as file, must exist physically within your application. It's not an eclipse thing, it's the nature of the web app your are developing using eclipse (and probably deploying using eclipse). An option for serving that local file can be to define a servlet + servlet-mapping which then can be used to read the content of that file and set it as the http-response content.

I don't know your use case, however when it comes to delivery it might be useful to ship the welcome page within your application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM