このリクエストを処理する ajax リクエスト関数 (JavaScript で記述) と Java サーブレットがあります。すべてのリクエスト パラメータを取得する必要があり、成功した場合は、成功したという確認を送り返します。確認メッセージを送信するにはどうすればよいですか? のような属性として{isSuccess: true}
。私のコード:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
Enumeration<?> paramNames = request.getParameterNames();
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
// storing data fn
}
// how to send back a message here?
}