[英]Struts2 - Accessing the element and action in JavaScript
在Struts1中,您可以使用以下語法在Javascript中訪問表單元素和操作:
document.forms.elements
和
document.form.action
在struts2中不存在表單類,為了從Struts1遷移到Struts2,我使用了ModelDriven
接口來提供一個模型對象,該模型對象除了動作外還可以推入到值堆棧中。
如何在Struts2中訪問表單操作屬性?
在javascript中,您不能訪問Struts1或Struts2的服務器端對象。 但是您可以像這樣訪問form
元素及其動作屬性
<s:form name="formName" ...
document.forms["formName"].action
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.