我正在開發使用JSF 1.1的工具,我有這樣的問題: 我有我的支持bean一個字符串,它打印爲:字符編碼1.1
./src.cpp: In function ‘int main()’:
./src.cpp:4: error: ‘dsdada’ was not declared in this scope
上的txt文件。
但是,當我把它放在H:inputTextArea,它是這樣的:
./src.cpp: In function ‘int main()’:
./src.cpp:4: error: ‘dsdada’ was not declared in this scope
-
<%@ page contentType="text/html;charset=UTF-8" %>
and this
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
但它也不能工作。 有人可以告訴我如何解決這個問題。由於
/* String[0] as stdout, String[1] as stderr */
String[] results = sshBO.execCommand(cmd, timeout);
/* Done with SSH things */
sshBO.closeSession();
/* Bring the output and err to the presentation */
msg = results[1]+results[0];
FileServices.saveStringToFile("F:/myoutput.txt", msg);
msg = new String(msg.getBytes("UTF8"), "UTF8"); /* makes no difference */
在JSP頁面:
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://sakaiproject.org/jsf/sakai" prefix="sakai" %>
<f:view >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
...
<h:inputTextarea disabled="true" value="#{SSH.msg}" styleClass="myTextArea" />
感謝BalusC,我嘗試在我的頁面中添加<%@ page pageEncoding =「UTF-8」%>,但它似乎不起作用。發生同樣的問題。還有什麼我應該嘗試?順便說一下,你有一個偉大的博客。我沒有學習從你的博客上傳文件:)。 – HoaPhan 2011-05-17 14:34:31