I am currently working on a web application that uses the draw2d library to draw shapes and diagrams. On the server side, I use Java (JSF).
I can say that 95% of this application is just pure JavaScript. I like to send Ajax requests from my JavaScript without the need for hidden fields like <f:inputText>(possibly using jQuery Ajax components?).
I tried to hack this by adding another hidden JFS component and jsf.ajax.request, but for some reason they are not very reliable and sometimes they do not send an ajax request.
Any suggestion? Also, about jQuery, I'm not sure how to handle the request on the server side.
Answer: I decided to use what Dave suggested. I previously tried to use jsFunction from this, but I got an error. Apparently, the problem is that it is not yet implemented in Richfaces 4. However, if you use, as the dave said, it works fine.
Another point, beans didn't work for me, like Dave Pot. I had to change it as follows: @ManagedBean (name = "jsFunctionBean") @SessionScoped public class JsFunctionBean {
private String name;
public String getName() { return this.name; }
public void setName(String name) { this.name = name; }
private boolean test;
public boolean getTest() { return this.test; }
public void setTest(boolean test) { this.test = test; }
public String getActionMethod() {
return null;
}
public String actionMethod(){
this.test = true;
this.name = "Dave";
return null;
}
}
I'm not sure why this is so, but if I remove getActionMethod or actionMenthod, I get an error!
source
share