【发布时间】:2011-10-25 10:38:03
【问题描述】:
/* 当前页面网址*/
/AddProduct.jsp?categoryId=1/
<script type="text/javascript">
function abc(){
var hashes = window.location.href.slice(window.location.href.indexOf('?')+1).split('&');
window.location="addproduct.action?"+hashes;
return false;
}
</script>
</head>
<body>
<s:form method="post" enctype="multipart/form-data">
<s:textfield label="Name" name="productBean.name" id="productBean.name"/>
<s:textfield label="Price" name="productBean.price" id="productBean.prsice"/>
<s:textfield label="Description" name="productBean.description" id="productBean.description"/>
<s:label name="upload" value="Image"></s:label>
<s:file name="upload"> </s:file>
<s:submit onclick='abc()' value="Add Product" ></s:submit>
</s:form>
我想从 url 获取参数,当表单提交时,url 参数将附加到一个新的操作(addaction)
问题
获取“categoryId=1”并在按下提交按钮时附加“categoryId=1”和操作
【问题讨论】:
标签: javascript struts2