📄 index.jsp
字号:
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<s:head theme="ajax" debug="true" />
<script type="text/javascript">
dojo.event.topic.subscribe("/save", function(data, type, request) {
if (type == "load") {
dojo.byId("addresstype").value = "";
dojo.byId("street").value = "";
dojo.byId("zip").value = "";
dojo.byId("location").value = "";
dojo.byId("pbox").value = "";
dojo.byId("country").value = "";
}
});
dojo.event.topic.subscribe("/edit", function(data, type, request) {
if (type == "before") {
var id = data.split("_")[1];
var tr = dojo.byId("row_" + id);
var tds = tr.getElementsByTagName("td");
dojo.byId("id").value = id;
dojo.byId("addresstype").value = dojo.string.trim(dojo.dom.textContent(tds[0]));
dojo.byId("street").value = dojo.string.trim(dojo.dom.textContent(tds[1]));
dojo.byId("zip").value = dojo.string.trim(dojo.dom.textContent(tds[2]));
dojo.byId("location").value = dojo.string.trim(dojo.dom.textContent(tds[3]));
dojo.byId("pbox").value = dojo.string.trim(dojo.dom.textContent(tds[4]));
dojo.byId("country").value = dojo.string.trim(dojo.dom.textContent(tds[5]));
}
});
</script>
</head>
<body>
<div style="width: 100%; border-style: solid">
<s:form action="save" validate="true">
<s:textfield id="id" name="companyAddress.addressid" cssStyle="display:none" />
<s:textfield id="addresstype" label="label.addresstype" name="companyAddress.addresstype" />
<s:textfield id="street" label="label.street" name="companyAddress.street" />
<s:textfield id="zip" label="label.zip" name="companyAddress.zip" />
<s:textfield id="location" label="label.location" name="companyAddress.location" />
<s:textfield id="pbox" label="label.pbox" name="companyAddress.pbox" />
<s:textfield id="country" label="label.country" name="companyAddress.country" />
<!-- Submit -->
<s:submit theme="ajax" targets="companyAddressList" notifyTopics="/save" />
</s:form>
</div>
<s:url action="list" id="listUrl" namespace="/admin/company/address" />
<div style="width: 100%; border-style: solid">
<div style="text-align: right;">
<s:a theme="ajax" notifyTopics="/refresh">Refresh</s:a>
</div>
<s:div id="companyAddressList" theme="ajax" href="%{listUrl}" loadingText="Loading..." listenTopics="/refresh" />
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -