ユーザー名とパスワードを送信してデータベースに保持する単純な JSF フォームがあります。
最初のフォーム送信でのみ、UTF-8 文字に問題があります。最初の投稿でğüüüççを送信すると、間違った文字が表示されます。2回目の試行では、問題ありません。
これが私のweb.xmlとindex.xhtmlです:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
と私の index.xhtml :
<!DOCTYPE html>
<html lang="tr"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>Title</title>
</h:head>
<h:body>
<div class="container">
<h:form styleClass="form-signin" prependId="false" id="registirationForm">
<h2 class="form-signin-heading">Please Register!</h2>
<h:inputText styleClass="input-block-level" value="#{registirationFormBean.nickname}" />
<h:inputSecret styleClass="input-block-level" value="#{registirationFormBean.password}"/>
<h:commandButton styleClass="btn btn-large btn-primary" value="Register Me!" action="#{registirationFormBean.registerUser}"/>
</h:form>
</div>
</h:body>
</html>
編集:これはTomcatのserver.xmlからのものです
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
URIEncoding="UTF-8"
/>
アプリケーションをデバッグすると、最初の投稿で次の値が表示されます。
しかし、2回目では: