Answer the question
In order to leave comments, you need to log in
Incorrect encoding when passing a GET request from JavaScript to Java, what should I do?
There is a script on the HTML page:
<script type="text/javascript" charset="utf-8">
function onClick(form) {
var largePath = $('#popupDiv .dinamic').attr("src");
var fileName = largePath.substr(largePath.lastIndexOf('/')+1);
$.get(
"setComment",
{
file_name : fileName,
comment : form.comment.value
},
onSuccess()
);
...
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
String fileName = request.getParameter("file_name");
String comment = request.getParameter("comment");
...
Answer the question
In order to leave comments, you need to log in
Well, first of all, why are you passing comment in the get request? Pass these parameters through the post.
Second replace URIEncoding="UTF-8" in server.xml for Connector
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question