入力テキストエリアの値を取得し、コマンドボタン「コンパイラー」をクリックして同じページに表示したいのですが、結果が得られません! contnet は、ブラウザー アップデーターで更新した場合にのみ表示されます。Sh ページとマネージド Bean を更新して、同じページに Primefaces テキストエリアのコンテンツを表示する方法は次のとおりです。コードは次のとおりです。
<p:layoutUnit position="west" size="520" header="Code à executer" resizable="true" >
<h:form id="moncode">
<p:inputTextarea id="mycode" value="#{fichier.code}" rows="17" cols="50" />
<p:commandButton value="compiler" id="btn3" action="guest.xhtml" styleClass="myButtonClass" />
</h:form>
</p:layoutUnit>
<p:layoutUnit position="east" size="550" header="Resultat d'execution" resizable="true" >
<h:outputText value="#{fichier.code}" />
</p:layoutUnit>
<p:layoutUnit position="south" >
私のアプリケーションは、特定のコードをコンパイルすることです。コードを記述し、「コンパイラ」ボタンで実行したため、ファイルが作成されますが、ファイルは常に「null」で作成され、var「コード」がそうではないためだと思いますまだマネージド Bean に設定されているため、ページを更新してマネージド Bean をここで設定する必要があるのは compile です。プライベート文字列エラー。
public String getCode() {
return code;
}
public String getError() {
return error;
}
public void setCode(String code) {
this.code = code;
}
public void compile() throws IOException {
File file = new File("C:\\Users\\Rad1\\test.c");
PrintWriter ecrivain;
ecrivain = new PrintWriter(new BufferedWriter (new FileWriter(file)));
ecrivain.println(code);
ecrivain.close();
`