I have static HTML pages. Using the Apache server (through XAMPP) I used to put my HTML files in the htdocs folder and they would be accessible through the localhost URL.
I'm not sure how to do this with Websphere Liberty server. let's say I have the following HellWorld HTML example in index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HellWorld</title>
</head>
<body>
<p>HellWorld</p>
</body>
</html>
How can I get this HTML page to show in the browser through Liberty?
The minimum folder structure needed is the following
To create the
.warfile just zip yourindex.htmlfile and then change the extention of the zipped folder from.zipto.warIf you are running Liberty sever in foreground through
server runcommand, as soon as you put this website in Liberty'sdropinsfolder (usually located here:...\wlp\usr\servers\YourServerName\dropins) you will get something like the following update:If you go to
http://localhost:9080/SampleHTMLSite/index.htmlyou should be able to see your HelloWorld HTML page.If you get the following error:
Open your SampleHTMLSite.war with any unzipping program (example: 7-Zip) and be sure that the
index.htmlis showing directly inside the.warfile and not inside another folder. There is a chance that you have the following structure:This would mean to access the
index.htmlyou need the following URL:http://localhost:9080/SampleHTMLSite/SampleHTMLSite/index.htmlIn bigger project and where you need to use Java apps your folder structure might need to include other folders and files. If you are intrested to know more about this, check the following article:
Handling Static Content in WebSphere Application Server