Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF Limitations
    primarykey
    data
    text
    <p>I'm currently just exploring JSF 2 in the Java EE 6 stack.</p> <p>I find quite a bit of limitations with JSF and the way ManagedBeans are used is very counter-intuitive / odd:</p> <p>It seems that, in order to execute an action event, you have to use <code>&lt;h:commandLink&gt;</code> tag. Thats all well if I was for example, posting form data. However in this case, all I wanted to do was to simply view a book using the url e.g.: <code>viewBook?id=2</code>. If i was using spring, it would have been easy: </p> <pre><code>@Controller public class BookController { @RequestMapping("/viewBook") public String viewBook(@RequestParam("id") Long id, Model model) { // all the method params(id, model) are provided by spring BookDTO book = bookService.load(id); model.addAttribute("book", book); return "BookView"; } } </code></pre> <p>However using JSF, I have to:</p> <pre><code>&lt;h:form&gt; &lt;h:commandLink value="#{bookController.viewBook}"&gt; &lt;f:param name="id" value="#{book.id}"/&gt; &lt;/h:commandLink&gt; &lt;/h:form&gt; </code></pre> <p>and the backing bean:</p> <pre><code>@ManagedBean public class BookController { private BookDTO book; public String viewBook() { Long id = Long.parseLong(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterValueMap().get("id")); book = bookService.load(id); return "BookView"; } // ... } </code></pre> <p><strong>Question is</strong>: Is there a framework for JSF2 that provides what spring MVC does?</p> <p><strong>Another question is:</strong> What does JSF provide that couldn't easily be achieved using Spring ?</p> <p>In my view, the whole JSF / Facelet etc technology is overly complex, over-engineered and counter-intuitive. I hold the same view on EJBs btw.</p> <p>These views are formed after having explored Java EE 6, by writing a small Java EE web application.</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.
    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