调用Java函数的Javascript函数

调用Java函数的Javascript函数,javascript,java,Javascript,Java,我有一段代码,我只希望它在单击时运行。但是,问题是无论是否单击按钮,scriptlet notificationDAO.read始终在运行 Html: Javascript: function read() { <% notificationDAO.read(((User)session.getAttribute("user")).getEmployeeID()); %> } 这完全是预期的行为-作为页面生成过程的一部分,在服务器上运行代码。html

我有一段代码,我只希望它在单击时运行。但是,问题是无论是否单击按钮,scriptlet notificationDAO.read始终在运行

Html:

Javascript:

function read() {
    <%
        notificationDAO.read(((User)session.getAttribute("user")).getEmployeeID());
    %>
}

这完全是预期的行为-作为页面生成过程的一部分,在服务器上运行代码。html不是bidirectional@JaromandaX这意味着代码总是在运行之间吗?是的,因为当生成要发送到服务器的html内容时,代码在服务器上运行browser@JaromandaX哦。。非常感谢。
function read() {
    <%
        notificationDAO.read(((User)session.getAttribute("user")).getEmployeeID());
    %>
}