public String getVatNetAmount()
    {
        String expensetype = getRequest().getParameter("type");
        String localAmount = getRequest().getParameter("amount");
        Double localamt = Double.parseDouble(localAmount);

        Double netAmount;


        netAmount = getExpensesTypeManager().getVatNetAmount(expensetype,localAmount);

         am = (float) ((localamt * netAmount)/100);
        // getRequest().setAttribute("NetAmount", am);

        return INPUT;
    }


这是我的Java类方法,我想在jsp页面或javascript函数中的变量am中获取数据?

最佳答案

您可以通过这种方式使用:

<%
    String var="sth";
%>

<script>
     var value = "<%=var%>";
</script>

10-07 15:32