0
我想在我的XHTML文件中包含一個EJS文件,以便我可以將數據傳遞給託管bean。 我試圖通過包含在腳本標籤作爲,但我沒有從EJS文件的值到XHTML文件。 任何人都可以請幫助我以正確的方式在HTML/XHTML文件中包含一個EJS文件。如何導入HTML文件中的EJS文件
感謝,
ind.ejs
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<h1> Date is: </h1> <%= new Date() %>
Room Type is: <%= checkindt %> <br />
Room Type is: <%= roomtype %>
</body>
</html>
app.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<head>
<script type="text/javascript" src="/ind.ejs" > </script>
<title>My App</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script type="text/javascript" >
function setValue(){
alert('app.xhtml');
alert('cindt is: '+ checkindt);
document.getElementById('myForm.cindt').value = checkindt;
}
</script>
</head>
<body>
<div>My app</div>
<form name="myForm" >
Date: <input type="text" name="cindt" />
<button id="submit" onclick="setValue();" />
</form>
</body>
</html>