1
我想在jsp文件中點擊按鈕時觸發一個函數。 我寫這個代碼:onClick jsp按鈕功能
<%!public void PrintOut(){
System.out.println("okk");
} %>
<body>
<button onclick="PrintOut()"> print OK</button>
</body>
但它不起作用。 當我使用
`<script>
function myFunction(){<%
System.out.println("OKK");%>}
</script>`
它在我點擊按鈕之前執行。