將JAVA WEB應用部署到Mopaas上
阿新 • • 發佈:2019-02-06
Mopaas:www.mopaas.com
可免費提供java web伺服器,上傳war檔案即可部署。
1.開發一個簡單的JavaWeb應用
- Jsp程式碼
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head >
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>testMopaas</title>
</head>
<body>
<h1>Hello testMopaas :First Page</h1>
<meta http-equiv="refresh" content="5,url=HelloWorld">
</body>
</html>
Servlet程式碼
web.xml程式碼
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>com.java.demo.HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping >
- 匯出war包
2 上傳到mopaas
3.訪問
4.問題
最開始開發的專案是使用JDK1.8,然而mopaas使用JRE1.6的環境執行。後來將JDK換成1.6。並且需要將java版本調至1.6