I have a couple of probably common thoughts on JavaServer Faces (JSF) which I want to clear up.
- Is it possible to just add a Java Class and Call methods inside it from a JSF (x) Page?
I can't see how this even could be an issue knowing to do when you program Java and develop webapplications. However, I can't seem to find a concrete and straight forward guide on this.
As a side-note I am using JDeveloper from Oracle.
I want to be able to just create a JSF Page as easy as I create a ASP.NET Page and from somewhat a "Code-behind" I want to process input and display outcome.
Please guide me in the right direction so I can navigate this JavaServer Faces jungle!
it's not generally possible to call arbitrary methods in backing beans from your JSF pages.
I suggest reading a decent JSF book or tutorial (the ones on the IBM website are a little old but still well worth reading).
In general backing beans work using "actions".
So, you define something like this in your page:
<h:commandLink action="#{backingBean.doSomething}" />
Then, in your backing bean you have:
public String doSomething() {
// Your logic goes here
return "navigation-target";
}
The String returned from "doSomething" will be a string as defined in your faces-config.xml
file, known as an "outcome", which will tell JSF which page to navigate to.
Hope this helps!