You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 4 Members of 9413 |
This page consists of an agenda and proposals put forth by Red Hat and its community for the JSF 2.1 specification . It's a continuation/overflow of the recommendations that were made for the JSF 2.0 specification.
Please also see the proposed changes for the EL 2.1 specification.
The page is divided into major and minor issues. Major issues are accompanied by a formal proposal. Both types cite references to a report in the JavaServer Faces specification issue tracker.
A priority grouped list of major issues that are accompanies by formal proposals and may require further design and discussion.
To allow JSF to fit better alongside action-oriented frameworks (and existing applications that use them), we propose the addition of view actions. View actions are the compliment of a UICommand for an initial (non-faces) request. View actions accommodate scenarios such as registration confirmation links, security and sanity checking for a request (e.g., valid resource identifier).
Refer to the JSF enhancement: View actions page.
Time zone handling has always been a pain point of JSF. To be specific, it's the time zone offset used when displaying a time (or datetime) using JSF that's troublesome. Storage of times is typically assumed to be relative to UTC.
The issue is that time zones are very much a user setting, not a system setting. Yet the only control mechanisms in JSF related to time zones are to adjust the default time zone used by the application. We would like to explore the possibility of making the time zone a dynamic binding that can be fulfilled by a managed bean that reflects the user's setting.
See the JSF Enhancement: Default application time zone page.
The idea of applying a validator to an entire subtree of the JSF UI component tree was prototyped in JSF 2.0 via the Bean Validation integration. We would like to make the ability to apply a validator to a subtree applicable to all validator tags.
The implementation of this generic proposal should replace the partial solution that currently exists to support the BeanValidator requirements.
The biggest pain point in JSF is arguably the lack of support for multi-component (or inter-component) validation. It's easy enough to apply a validator to a single component. But when the value of a related component is needed in order to validate the current component, the JSF validation model breaks down. As a result, the developer has to implement a custom solution (and quite a lot of code) to get it to work.
An example of multi-component validation is validating a credit card number based on the credit card type, validating a car model based on it's make, or validating that one date precedes or follows another date.
Currently the UIData and UIRepeat components narrowly support java.util.List rather than the more generalized java.util.Collection. This behavior is extremely inconvenience since the interface java.util.Set is prevalent in JPA entity classes, a central component in most enterprise web applications. This forces the developer to have to constantly wrap the sets as lists using various creative approaches.
This issue was raised by both Adam Winer a while back. He presents a rather obscure solution in this entry, though one that likely many developers use out of necessity:
But what about the point that a Collection is not indexed by definition? Up to this point, all collection types that JSF supported have been indexed collections. There are two issues to address when introducing support for a non-index collection:
The first is a concern of the implementation and the second a developer concern. In order to iterate a Collection that is not a List, we have to keep an internal List. Doing that has an important side effect (which is not negative, just different). The result of getWrappedData() is not going to be the original collection. It's either an abstract collection with a shared iterator or a copy.
The ordering is a concern of the developer feeding the collection into the UIData or UIRepeat. Maybe the developer doesn't care that each time it iterates, the order is different. Maybe the developer is using an ordered but not indexed collection such as a LinkedHashSet or a TreeSet. The point is, UIData and UIRepeat should be able to iterate a basic java.util.Collection.
Facelets eats whitespace. When two components have only whitespace separating them, Facelets will trim that space so that the output of the two components are mashed together. You see this most often with links.
<h:commandLink value="Link 1"/> <h:commandLink value="Link 2"/>
Here's what the rendered output looks like to a user:
Link 1Link 2
To get around the problem, you can place a value expression that produces a UIOutput component whose value is a space between them:
<h:commandLink value="Link 1"/>
#{’ ‘}
<h:commandLink value="Link 2"/>
This is super hackish. One way to fix Facelets is to remove the logic in the TextUnit#trimRight(String) method, which cuts out what Facelets perceives to be non-semantic whitespace.
The main reason that Facelets trims is to prevent creating components to represent the whitespace. One area in particular where this is an issue is a panel group. Consider:
<h:panelGrid> <h:outputText ... /> <h:outputText .../> </h:panelGrid>
In this scenario, the intention is to create a two column table to encapsulate the two outputs, but if there is trailing whitespace after either of the output text fields, you end up with a three column table because the whitespace wasn't trimmed and Facelets generated a component for it.
Frankly, I don't give a damn. In my mind, Facelets is broken. I have been hammered on this issue more times than I care to say. Mangers question why I would chose a technology that does such a silly thing. We need to resolve this one way or another because we can't go forward with status quo.
One solution is to have a trimming
setting per component which determines whether whitespace is trimmed in the component's direct decedents. This should likely be part of the component metadata.
JSF 2.0 introduced a new exception handling mechanism which queues unexpected exceptions and passes them to the registered ExceptionHandler. The default implementation wraps the root exception in a ServletException, allowing the developer to use the <error-page> directive in web.xml to associate an error page with a given exception class. But the servlet exception handler operates outside of the JSF life cycle, which is often inappropriate for dealing with exceptions that originate from within the JSF application.
Seam's pages descriptor has a section which allows a developer to associate an exception with a navigation rule. We would like to bring this feature to JSF 2.1 so that the exception can be handled within the boundaries of the JSF life cycle. Leveraging the JSF ExceptionHandler to deal with the exception makes it possible to do things like navigation to a view ID (rather than a servlet path), add a faces message to the request, append redirect parameters and/or log a message, all through configuration.
PENDING
There are several features in JSF which require one component to reference another component. There are slight variations in the algorithm used to find the related component between implementations, exposing the fact that a spec clarification is needed. In addition, there are two other concerns to address: usability and performance. We would like to find a flexible syntax with a consistent interpretation for component referencing.
PENDING
See the JSF Enhancement: Component referencing page.
forattribute is mis-specified
The rendered attribute is an Achilles heal of JSF performance. JSF abuses the value expression used in rendered attributes. It's expected that the value expression is going to be resolved more than once on a request because by nature it is a pass-through construct and because the value it is representing is likely contextual (meaning it can change as the application changes). However, in the case of the render attribute, it's a little bit out of control. Any getter method bound to a rendered attribute is being called way too many times. This could easily be solved by being more frugal about when it is consulted.
For example, the rendered value expression is resolved in encodeChildren, encodeBegin (or encodeParentAndChildren) and again at encodeEnd of most components. We should state that when a component is first addressed during encoding (perhaps in encodeBegin) that is when the rendered attribute should be evaluated. Then the resolved value simply cannot change again in that phase. (The exception would be a row in UIData, which the rendered attribute would need to be resolved once per component per row).
The point is that the isRendered() method should be smarter than just evaluating the EL every single time it is called. It should do a rendered check only in encodeBegin. Such a solution only affect a small part of the problem though. For one it only partially fix the issue for a single attribute (rendered) since it saves 2 evaluations out of 3 during render response which is nice when it's a GET request (66% improvement), but much less important during postbacks where it's only going to save 2 evaluations out of 7 (28% improvement).
We should also consider having encodeAll check the rendered attribute and not encodeBegin. Or, we could keep the current contract the same but deprecate encodeBegin, encodeChildren, encodeEnd and getRendersChildren so that most people start using encodeAll instead so that isRendered gets called only once per component per render phase execution.
See the entry It's time for Facelets to start using XSD for background and a sample implementation. Review the issue reports for the details of what's being requested, including the possibility of a different file extension.
These are issues which don't require much or any design work.
set. The argument type must be assignable to the property's type, but there should be no restriction on return type (allow non-void return values to support the builder pattern).
Referencing an object by its namespace should be sufficient:
UIComponent comp = Application.createComponent(FacesContext, "http://java.sun.com/jsf/composite/mynamespace:component").
Attributes would be assigned via the normal method:
comp.getAttributes().put("rendered", false);
This would greatly extend the reach of EzComp objects.
Thanks,
Lincoln
I've emailed this to the JCP.
Is anything being done to make JSF faster and take up less memory?
The Seam debug page goes a long way to help debugging problems in .xhtml pages, but still JSF exceptions currently are very verbose but don't give much help. It would be nice to see that improve.
However, I don't see why whites paces being eaten is such a burning P1 issue. I for one wouldn't want all that white-space from view sources (that has nothing to do with the actual representation and is used generously to make the *view source* readable) to make it into the final rendering. Especially if you consider that JSF may be rendered in other formats than HTML, which do not collapse white space.
We came up with a simple, elegant and much more powerful solution for separating components in a generic way, whether with white space, commas, | bars or anything you like, by creating a custom renderer for javax.faces.Panel.
example:
<mylib:group separator=" | ">
<h:outputLink .../>
<h:outputLink ... rendered="#{false}" />
<h:outputLink .../>
</mylib:group>
being rendered as link1 | link3
The idea can be further expanded by making the separator a facet to support other UI components in the separator (<hr/>?), a layout attribute for wrapping children in <span> <div> or nothing, etc.
Greg
ps: I couldn't find a way to add this comment to dev.java.net facelets issue 332.
It's not that I don't want any whitespace. It's that Facelets is inconsistent with how it handles whitespace. It trims to the right, but not to the left. As a result, you sometimes get space between elements, sometimes not, depending on how they are arranged. That's freaking annoying and has caused me terrible embarrassment in front of stakeholders in the past (and nothing makes me more pissed than being put in that situation). So I want a real solution that is consistent. I don't want hacks, workarounds, or elegant solutions pasted on top of JSF.
Dan Allen | mojavelinux.com | Author of Seam in Action
Proposals:
1. Easy subclassing of components, like in Wicket 2. Inroduce easy way to bind to methods and values in Java (see Wicket). Build existing bindings on top of that. 3. Strongly define when evaluation are invoked, what context is used (what we allowed to do in that context).
For fun I would like to add yet more proposal ...
4. Die and let good frameworks to make developers happy.
Don't forget RESTful URL support like in PrettyFaces. JSF 2.1 absolutely must have it built in, and it shouldn't have been left out of JSF 2.0. Bookmarkable URLs was almost dropped from 2.0 until a bunch of people made some noise about it. I can't believe the expert group would even consider releasing JSF 2.0 without Bookmarkable URLs. At least we got them, but without !!! It a real shame that we'll probably have to wait another 3 years for the next revision of JSF, and will have to rely on addons to complete it like we did in the 1.x days. The anti JSF crowd will continue to use the argument that JSF needs addons to fix it or make it usable.
On a lighter note, congratulations to the expert group on the rest of the work they completed in JSF 2.0. You've certainly identified all of the pain points and addressed most. The number 1 top-of-my-list thing I was looking forward to in JSF 2.0 was bookmarkable URLs with view actions, and RESTful URLs. Arrrgg....
Another absolute must for JSF 2.1 that should not have been left out of 1.0 is a usable radio button component that lets me place the buttons from a group wherever I want!!
Ryan, I stepped in and pushed for the bookmarkable URLs and RESTful-like URL support (i.e., PrettyFaces) as hard as I could. It's true we didn't get everything we wanted, but we laid a solid foundation that should make it easy to add in the next rev. I can assure you that the next revision is not going to be 3 years, or even 2 years. I want a quick maintainance release and then get the next version done by next year. Until then, we will prototype all features in Seam (2 or 3).
As for view actions, they are super simple to implement on top of 2.0. So while it sucks it has to be an extension, it really isn't all that horrible.
Most important of all, JSF 2.0 and beyond will be completely open. Finally, the community will have a strong voice and I am confident we can clean up what mess remains and feel good about the standard web framework in the Java EE platform. Let's just keep a constructive mind because things are shaping up.
Dan Allen | mojavelinux.com | Author of Seam in Action
I'm running out of space in this document, so I'm going to use a comment for now. I'd like to be able to classify a validation as a warning. The first time the form is submitted, a warning validation failure would halt processing and rerender the page. If the user submits again w/o any changes to the form, the validation warnings would be ignored and the form submitted.
Dan Allen | mojavelinux.com | Author of Seam in Action
I'd like to point to one important thing that's missing in Mojarra AJAX - that's lack of the client-side event that will allow components and HTML elements to be notified about AJAX updates. This feature is important for performance. We've already started discussion on this at RichFaces development forum: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=158804
Under minor issues section is , and it mentions that a ticket number is needed. There is already a ticket for this.. please update the wiki:
Issue 329
Updated. Thanks!
Dan Allen | mojavelinux.com | Author of Seam in Action
I guess I am a bit late to make a comment here, but will multi-component validation handle validators defined at the Bean level?
I.e., it is trivial to define a Start-Date before End-Date Hibernate Validator at the Bean(Class) level. The issue is that even if all the components get their values assigned before validation starts, the bean itself has not been instantiated.
I have created my own intercepting before the validation event and creating a bean, then applying the class level validator.
Clearly this is something that should be done within JSF.
SeamFaces seeks to fix that issue, but it's something that should (in my ignorant opinion) really be part of the core of JSF.
Currently, if you have a List<Entity> and you want to permit the user to select zero or one of them, you appear to have to add a null entry in the list or copy the list's contents to a JSF-specific list of selectable items that includes a "no object" placeholder. That's painful when you're generally binding JPA query results to controls.
Ideally, s:selectOneMenu and friends would, if required=false, permit use of an attribute on the contained f:selectItems that implicitly added "null" to the list of permitted selections and specified a display label for that option. The current noSelectionValue, by contrast, has to be an entry in the collection, requiring the introduction of dummy items at the model end.
Something like the following (currently illegal) code would be great:
<s:selectOneMenu required="false">
<f:selectItems value="#{someModel.someList}" var="n"
itemValue="#{n}" itemLabel="#{n.someAttribute}"
selectNonePermitted="true" selectNoneLabel="(None)"
</s:selectOneMenu>
... as it'd free the backend developer from needing to insert dummy "no value" entries in the collections sent to JSF views.
(It's possible I'm missing the obvious way to do this - but NetBeans generated code does it by wrapping, there's nothing suitable in the JavaDoc, and the existing noSelectionValue attribute doesn't do it.)