JSP form action 如何引用js变量用于传递?
在javascript中按以下的写法可正确传值到servlet:
$.ajax({ type: "POST",
cache: false,
async: false,
url: "../servlet/StlZCRPFEditServlet?tsVal="+new Date().getTime(),
data: ...
如何在下面的action 中加上所需传递的时间值呢?
<form id="EditForm" name="EditForm" class="mainform" action="servlet/TestServlet" method="post" target="formTargetIframe">
注:写成 action="servlet/TestServlet?tsVal=111111" 是可以传递的
[解决办法]
<form id="EditForm" name="EditForm" class="mainform" action="servlet/TestServlet" method="post" target="formTargetIframe">改成
<form id="EditForm" name="EditForm" class="mainform" action="servlet/TestServlet?tsVal=<%=new Date().getTime()%>" method="post" target="formTargetIframe">
<form id="EditForm" name="EditForm" class="mainform" action="servlet/TestServlet?tsVal=<%=new Date().getTime()%>" method="post" target="formTargetIframe">
getTime--><%=new Date().getTime()%>
</form>