導航:首頁 > 編程語言 > javahtml模板

javahtml模板

發布時間:2023-06-15 12:20:30

java發送html模版的郵件

setContent(參數),裡面的字元串要是完成的html代碼,"<html><head></head><body></body></html>",這種,我只寫了個大概,反正就是要是完整的html代碼,祝你成功

⑵ JAVA根據模板生成HTML頁面的技術

Velocity

變數定義:用$標志

表達式語句:以#開始

強控制語言:變數賦值:#set $this = "Velocity"

外部引用:#include ( $1 )

條件控制:#if …. #end

非 兼容性語 言

JDynamiTe

變數定義:用{}包裝

表達式語句:寫在注釋格式(<!-- ?)中

弱控制語言

兼容語言

XSLT

變數定義:xml標簽

表達式:xsl標簽

強控制語言:外部引用:import,include

條件控制:if, choose…when…otherwise

非兼容語言

Tapestry

採用component的形式開發。

變數定義(組件定義):在html標簽中加上jwcid

表達式語句:ognl規范

兼容語言

⑶ 誰做過java自動生成html 原理講下

大概就是一樓的那個意思 給你個小例子你看下;
先創建一個html模板:
<html>
<head>
<title>###title###</title>
<meta http- equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../css.css" rel=stylesheet type=text/css>
</head>
<body>
<table width="500" border="0" align="center" cellpadding="0"
cellspacing="2">
<tr>
<td align="center">
###title###
</tr>
<tr>
<td align="center">
作者:###author###
</tr>
<tr>
<td align="center">
###content###
</td>
</tr>
</table>
</body>
</html>

java代碼
import java.util.*;
import java.io.*;

public class HtmlFile {
public static void main(String[] args) {
try {
String title = "Make Html";
String content = "小樣,還搞不定你?";
String editer = "秋水";
//模板路徑
String filePath = "leon.html";
System.out.print(filePath);
String templateContent = "";
FileInputStream fileinputstream = new FileInputStream(filePath);// 讀取模板文件
int lenght = fileinputstream.available();
byte bytes[] = new byte[lenght];
fileinputstream.read(bytes);
fileinputstream.close();
templateContent = new String(bytes);
System.out.print(templateContent);
templateContent = templateContent.replaceAll("###title###", title);
templateContent = templateContent.replaceAll("###content###",
content);
templateContent = templateContent
.replaceAll("###author###", editer);// 替換掉模板中相應的地方
System.out.print(templateContent);

// 根據時間得文件名
Calendar calendar = Calendar.getInstance();
String fileame = String.valueOf(calendar.getTimeInMillis())
+ ".html";
fileame = "/" + fileame;// 生成的html文件保存路徑。
FileOutputStream fileoutputstream = new FileOutputStream(fileame);// 建立文件輸出流
System.out.print("文件輸出路徑:");
System.out.print(fileame);
byte tag_bytes[] = templateContent.getBytes();
fileoutputstream.write(tag_bytes);
fileoutputstream.close();
} catch (Exception e) {
System.out.print(e.toString());
}
}
}

⑷ java freemarker用模板生成靜態html頁面

freemarker是data+model=輸出。需要替換你模型的所有代號的,替換一次就行了,你的asp的eval實際上也是替換

⑸ 網上下的網頁模板怎麼用在javaweb上

網上下的網頁模板是靜態的html或者shtml頁面,要用在真實項目中需要把它們改寫成動態網頁jsp文件來在伺服器端執行。

修改方法如下:
1、點擊html文件,右鍵->重命名,修改成.jsp文件。
2、把.jsp文件導入工程中發布到web容器。
3、運行工程,用http://localhost:8080/test.jsp來訪問。

JSP全稱是JavaServer Pages,它和servle技術一樣,都是SUN公司定義的一種用於開發動態web資源的技術。
JSP這門技術的最大的特點在於,寫jsp就像在寫html,但:
它相比html而言,html只能為用戶提供靜態數據,而Jsp技術允許在頁面中嵌套java代碼,為用戶提供動態數據。
相比servlet而言,servlet很難對數據進行排版,而jsp除了可以用java代碼產生動態數據的同時,也很容易對數據進行排版。
不管是JSP還是Servlet,雖然都可以用於開發動態web資源。但由於這2門技術各自的特點,在長期的軟體實踐中,人們逐漸把servlet作為web應用中的控制器組件來使用,而把JSP技術作為數據顯示模板來使用。

閱讀全文

與javahtml模板相關的資料

熱點內容
我的世界hpixel伺服器地址 瀏覽:871
手機加密軟體輸出數據 瀏覽:876
oppo手錶怎麼連接手機app 瀏覽:933
pdf百科知識 瀏覽:515
程序員那麼可愛女主泡溫泉 瀏覽:557
自學軟體編程技巧 瀏覽:979
代理伺服器地址和埠分別是多少 瀏覽:533
怎麼下載氧氣app 瀏覽:150
哪裡可以接到一手注冊單的app 瀏覽:909
網盤沒有文件夾 瀏覽:143
上海通用在線編程網站 瀏覽:651
單個電競賓館怎麼做伺服器 瀏覽:813
wps中pdf如何轉word 瀏覽:681
程序員實力如何 瀏覽:426
php調用websocket 瀏覽:610
程序員被殺手看上 瀏覽:738
蘋果相冊加密軟體推薦 瀏覽:330
演算法導論分治策略 瀏覽:715
加工中心goto命令詳解 瀏覽:389
公司理財羅斯pdf 瀏覽:658