N
N
Nikolay Baranenko2017-05-25 03:38:18
Java
Nikolay Baranenko, 2017-05-25 03:38:18

Why does request.getParameter result in ?????? instead of UTF-8?

Hello.

there is JSP code

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="json" uri="http://www.atg.com/taglibs/json" %>

<c:set var="selected_region" value='<%= request.getParameter("selected_region") %>'/>
<c:set var="SCRIPT">
    select    solution, position
    from employee t1,region t2
    where region='${selected_region}'
</c:set>
<sql:query var="rs_employees" dataSource="jdbc/oracle">
    ${SCRIPT}
</sql:query>
${selected_region}
<json:object>
    <json:array name="employees" var="row" items="${rs_employees.rows}">
        <json:object>
            <json:property name="solution" value="${row.solution}"/>
            <json:property name="position" value="${row.position}"/>
        </json:object>
    </json:array>
</json:object>


why does request.getParameter("selected_region")
return ??????? instead of a normal value, do I transfer the parameter in UTF-8?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay Baranenko, 2017-05-25
@drno-reg

solved the problem by adding

<%
    request.setCharacterEncoding("UTF-8");
%>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question