Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF with Ajax question (apache myFaces Tomahawk)

 
Srinivasa John
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to JSF, trying to make a ajax call when radio button clicked. I wrote following code it's not working.

I am using apache myFaces (Tomahawk 1.2)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk"
>
<h:form id="form">
<hutputText id="out1" value="#{count.count}"/>
<br/>
<h:selectOneRadio valueChangeListener="#{count.count}" id="count1" value="#{count.count}" immediate="true" onchange="jsf.ajax.request(this, event, {execute: 'this.id', render: 'out1'}); return false;">
<f:selectItem itemLabel="goods" itemValue="1" />
<f:selectItem itemLabel="service" itemValue="0" />
</h:selectOneRadio>
</h:form>
</html>

Bean:
package com.blue.test

import javax.faces.event.ActionEvent;


public class Count {
Integer count = 0;

public Integer getCount() {
return count++;
}

public void reset(ActionEvent ae) {
count = 0;
}
}

if you have steps please post it here.

Thanks
John
 
Shasi Mitra
Ranch Hand
Posts: 101
Flex Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you to use ajax4jsf which is very easy to plug in.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic