Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF - A few beginner questions (from a PHP developer)
    primarykey
    data
    text
    <p>I am looking into Java Server Faces for a school project and because I am a developer in PHP, I am not able to grasp the overall concept of JSF.</p> <p>In usual PHP MVC framework, the requested URL is bound via routing system with an invoked class methods (controller life cycle) and rendered template, so I can trigger some logic before any output is sent to a browser, e. g. perform a redirect.</p> <p>Correct me if I am wrong - I was not able to recognize this pattern in JSF. URL is bound to the rendered template (faces/index.xhtml -> index.xhtml in my source code) and if I want to call some method in backing bean (JSF equivalent to controller), I can call any getter in a template (#{bean.property}), but for example I don't know how to perform a redirect when a URL is requested. I was able to perform some custom method in my backing bean after clicking on <code>&lt;h:commandLink&gt;</code> or <code>&lt;h:commandButton&gt;</code>, but after looking to the generated HTML (which always looked like a submitting form), I don't think it's the only way to do this.</p> <p>I also looked into faces-config.xml which looks like a nice way to configure multistep form wizards, but I don't know how to use this mechanism to define structure of the whole web. Which is it primarily used for? Defining URLs?</p> <p>Also, I would like to know something about the dependency injection system. I don't know what injects my facades into the backed bean class attributes when I annotate them with @EJB. I don't know what mechanism injects EntityManager into my facades if I annotate the "em" attribute with PersistenceContext. And how I can alter these mechanisms in unit tests that run without this DI container (Glassfish?).</p> <p>Please, can anybody clarify for me how does these things work in some friendly-PHP way? Thank you! :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload