Java 在webapp中显示控制台输出
我想开发一个web应用程序,它在服务器上进行maven构建,并在发生时显示构建控制台输出。我正在寻找类似的东西是什么在哈德逊可用 我已经阅读了这里给出的解决方案: 嗯,我可以运行脚本并获得整个输出,但我希望UI在构建过程中得到更新。我怎样才能做到这一点Java 在webapp中显示控制台输出,java,ajax,jsf,build,richfaces,Java,Ajax,Jsf,Build,Richfaces,我想开发一个web应用程序,它在服务器上进行maven构建,并在发生时显示构建控制台输出。我正在寻找类似的东西是什么在哈德逊可用 我已经阅读了这里给出的解决方案: 嗯,我可以运行脚本并获得整个输出,但我希望UI在构建过程中得到更新。我怎样才能做到这一点 使用JSF和Jboss Richfaces组件可以做到这一点吗?是的,您可以使用Richfaces的来实现这一点,以了解有关和使用它的最佳实践的更多信息。例如,它建议为和使用的周围使用一个单独的表单,为什么不能使用Hudson? <a4j:
使用JSF和Jboss Richfaces组件可以做到这一点吗?是的,您可以使用Richfaces的
来实现这一点,以了解有关
和使用它的最佳实践的更多信息。例如,它建议为
和
使用的周围
使用一个单独的表单,为什么不能使用Hudson?
<a4j:region>
<h:form>
<a4j:poll id="poll" enabled="#{testBean.enablePolling}" reRender="consoleOutput,poll" />
</h:form>
</a4j:region>
<h:form>
<a4j:jsFunction name="startBuild" action="#{testBean.startBuild}" />
<a4j:commandButton value="Start Build" action="#{testBean.startPolling}" oncomplete="startBuild()" reRender="poll"/>
<hr/>
<h:outputText id="consoleOutput" value="#{testBean.consoleOuput}" escape="false"/>
</h:form>
public class TestBean {
private boolean enablePolling;
private StringBuffer buildOutputSb = new StringBuffer();
public TestBean() {
}
public boolean isEnablePolling() {
return enablePolling;
}
public void setEnablePolling(boolean enablePolling) {
this.enablePolling = enablePolling;
}
public void startPolling(){
this.enablePolling = true;
}
public void startBuild(){
this.buildOutputSb= new StringBuffer();
//Stimulating the build process , which will output the log message to the buildOutputSb
for (int i=0 ; i <10 ; i++){
buildOutputSb.append("Output").append(i).append("<br/>");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
this.enablePolling = false;
}
}