hi all,
i got a problem with submitting a form using a JSF button without refreshing whole page. here's a sample of my code:
// in the JAVA
Button button = new Button();
button.setText("Submit Form");
button.setEscape(false);
String target = "targetId"; // this is the <div> or <span> to be updated by Ajax call
// in here 'sentTheForm(); is a javascript function
button.setOnClick("sendTheForm('" + target + "'); return false;");
// in JSP
// javaScript uses Prototype.js for Ajax call
function sendTheForm(target) {
new Ajax.Update(target, 'Server/ProcessForm', {method:'post'});
}
// on the server side a Servlet sitting there to handle the actions
......
java.util.Map map = request.getParameterMap(); // request is an HttpServletRequest
out.println("there are " + map.size() + " fields submitted");
......
i hope the code trunks show what i want to do. Basically, i m trying to submit a form using ajax, and refresh on field of the page only. The above code gives result as:
there are 0 fields submitted
which means the form is not actually submitted. i don't know where i got wrong in my code. somebody can help? THank you in advance!
best regards