Html 如何在ejs模板中呈现变量的内容?

Html 如何在ejs模板中呈现变量的内容?,html,express,ejs,Html,Express,Ejs,我有一个ejs模板,当页面加载时,它应该通过调用用户的名字来问候用户,但是它不会显示任何内容!这是我的模板: <!DOCTYPE html> <html> <head> <title>quotes</title> <link rel="icon" href="favicon.ico" type="image/x-icon"> <link rel="styleshe

我有一个ejs模板,当页面加载时,它应该通过调用用户的名字来问候用户,但是它不会显示任何内容!这是我的模板:

<!DOCTYPE html>
<html>
    <head>
        <title>quotes</title>
        <link rel="icon" href="favicon.ico" type="image/x-icon">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">;
        <link rel="stylesheet" type="text/css" href="stylesheets/profile.css">
    </head>
    <body>
        <div class="wrapper">
            <h1 class="title">profile</h1>
            <nav class="nav-bar">
                <ul class="nav-list">
                    <li><a href="/">home</a></li>
                    <li><a href="/logout">logout</a></li>
                </ul>
            </nav>

            // not displaying user here
            <h1 class="greeting">Welcome <% user %></h1>
            <form action="/quotes" method="POST" class="new-entry" autocomplete="off">
                <h2 class="subtitle">Add a quote</h2>
                <input type="text" placeholder="quote" name="quote" pattern=".{3,}" required oninvalid="this.setCustomValidity('3 characters minimum')">

                <input type="text" placeholder="author" name="author" pattern=".{1,}" required oninvalid="this.setCustomValidity('1 characters minimum')">

                <button type="submit" class="red-button">Add</button>
            </form>
            <footer>
                &copy; 2017
            </footer>
        </div>
        <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>;
        <script src="javascripts/main.js"></script>
    </body>
</html>

引用
;
轮廓
//不在此处显示用户 欢迎 添加报价 添加 &抄袭;2017 ;
您正在使用无效的ejs语法。假设代码在后端正确编写,则需要在开始的ejs标记中添加等号,否则模板不知道如何读取变量的内容

<%= user %>

应该给你你想要的结果


您可以在此处找到有关正确ejs语法的更多信息:

这解决了我的问题!谢谢