【发布时间】:2013-04-25 12:48:23
【问题描述】:
我想获取输入 Textarea 的值,并通过单击命令按钮“编译器”将其显示在同一页面中 但是我没有得到任何结果!并且仅当我使用浏览器更新程序更新时才显示 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“code " 尚未在托管 bean 中设置,为什么我要更新页面,所以这里设置的托管 bean 是编译: ` 私有字符串代码; 私有字符串错误;
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();
`
【问题讨论】:
-
更清楚地说明您的问题/要求。什么没有按您的预期工作?你的意图是什么?有什么错误?
标签: html jsf jsf-2 primefaces