如何将 UTF8 值放入 web.xml?

问题描述

我正在考虑将一些 UTF-8 字词放入 >>> out Account_Number Number_Transactions New_List 0 ABA 155 [APP] 1 ABC 1352 [APP] 2 AAA 95 [APP,API] 作为 web.xml,但不知何故这会导致我的战争无法部署到我的服务器。我的设置导致部署失败的情况如下所示。

env-entry-value

错误信息

<env-entry>
    <description>Msg text</description>
    <env-entry-name>Msg_Text</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>兔子</env-entry-value>
  </env-entry>

谁能教我怎么做?

======更新======

再次尝试使用分号 10:56:41,498 INFO [org.jboss.as.server.deployment] (MSC service thread 1-15) JBAS015877: Stopped deployment Test.war (runtime-name: Test.war) in 69ms 10:56:41,920 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015858: Undeployed "Test.war" (runtime-name: "Test.war") 10:56:41,920 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report JBAS014777: Services which Failed to start: service jboss.deployment.unit."Test.war".PARSE ,然后出现其他错误

&#53F0;

如果我用普通的 ascii 字符填充它,效果很好。我还错过了什么吗?

解决方法

  1. web.xml 必须包含 <?xml version="1.0" encoding="UTF-8"?><?xml version="1.0"?>:任何其他编码都会破坏 Unicode 文本内容。
  2. 以 UTF-8 格式编辑 web.xml;像 NotePad++ 这样的程序员编辑器就可以了。
  3. 对于十六进制,不要忘记 x&#x53F0;