<form action="${pageContext.request.contextPath}/CartServlet?method=addToCart" method="post" id="form">
<a href="javascript:void(0)" onclick="submit()">
<input type="button">
</a>
</form>
<script>
function submit(){
document.getElementById("form").submit();
}
function submit02(){
document.getElementById("form").method="post";
document.getElementById("form").action="http://www.baidu.com";
document.getElementById("form").submit();
}
function submit03(){
document.getElementById("form").method="post";
document.getElementById("form").action="http://www.51cto.com";
document.getElementById("form").submit();
}
</script>