一般的form表單提交方式要么是get要么是post,我打算自己在servlet里面寫自定義的函數(shù),比如login()函數(shù),而不去實(shí)現(xiàn)dopost和doget方法,這樣我form表單提交的時(shí)候加一個(gè)hidden參數(shù)method=login,于是運(yùn)行的時(shí)候就一直報(bào)405method not allowed的錯(cuò)誤,下面提示“HTTP method POST is not supported by this URL”<form class="form-horizontal" method="post" action="${pageContext.request.contextPath }/user"> <input type="hidden" name="method" value="login"> <div class="form-group"> <label for="username" class="col-sm-2 control-label">用戶名</label> <div class="col-sm-6"> <input type="text" class="form-control" id="username" name="username" placeholder="請輸入用戶名"> </div> </div> </div>
HTTP method POST is not supported by this URL 報(bào)錯(cuò)信息
幕布斯7119047
2018-10-12 18:31:22