Where createGraphs is your imported js function that builds the graph from the supplied data.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Jay Tai wrote: I'll use JSON if it's absolutely necessary but I figure it's easier to get the 'raw jQuery' working first.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
So In JSF, you never write Controller code (at least unless you're implementing your own custom tag!)
Jay Tai wrote:Maybe Monday's the reason it's not sinking in!
So In JSF, you never write Controller code (at least unless you're implementing your own custom tag!)
I'm confused about the term 'in JSF'. There's always a controller class in my jsf application.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Jay Tai wrote:@ E.Arimtage. So the library I'm using could include JSON as a default. I don't see any references to JSON. Is there an obvious way to check? Do you recommend any libraries that play well with JSF and use JSON? From my very limited knowledge I always thought of JSON as being used in cases where persistence without a database was required.
And, incidentally, yes, the JSF GUI Model is "dirty
Jay Tai wrote:So the only 'pure' JSF is actually a very simplistic data container part of the GUI part of the model. The rest of the model and the true power of JSF is how it talks to external POJOs, xml and property files.
Should I be including the JavaScript code in the model class instead of the controller?
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Most client side graphing libraries will use JSON anyway. You don't need to store the data in any hidden fields if you are using JSF2 + as you can use the syntax I mentioned above directly in your JS script.
Jay Tai wrote:
I decided to use d3 chart library. I can now pull in data from a POJO controller in my JSF application to populate a bar chart, declaring in the js script:
Jay Tai wrote:
Don't do this. Do the EL in the JSF page to call a Javascript function using the data (as I mentioned above).
<script type="text/javascript">
function refreshGraph(){
createGraphs(#{yourBean.graphData});
}
//if running on body load
$(function () {
refreshGraph();
});
</script>
JS libraries (like flot)use JSON as the format for the graph data and rendering properties. You really can;t get away from using JSON if you want to do client side programming these days.
Yes, you can return the data as XML from the backing bean method as well but that would not be wise if you still have to use JSON for your graph libraries
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
public Xtype getX() {
if ( this.x == null ) {
this.x = this.buildX();
}
return this.x;
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|