New Features in Seam 1.1.5
Thursday, February 1st, 2007One and half month after Seam 1.1 release and 14,000 downloads later (yes, Seam is breaking 10k download per month), we are now releasing the latest and newest Seam 1.1.5. It has some very nice features not found in *any* web application framework out there. Here are some highlights.
The rule-based finely-grained security framework
Managed security is one of those "half measure solutions" in J2EE. The standard J2EE security works okay for the simplest authentication cases (i.e., to put part of the site complete behind a password protected wall). But more often than not, developer struggle hard to fight against the standard security schemes than using it.
In Seam 1.1.5, we provide a much better security model based on the JBoss Rules engine. You can have a very detailed set of rules to specify who is permitted to access which page, which UI element, which bean methods. Users are managed in groups and the permission meta data are easily expressed in annotations and JSF tags. It is a security solution for almost every use case a web application encounters. Here are some examples to show how to restrict access to methods, pages, and components based on the user's role.
-
<!-- only users with "admin" role can view this page-->
-
<page view-id="/reports.xhtml">
-
<restrict>#{s:hasRole('admin')}</restrict>
-
</page>
-
// Only logged in users with role "admin" can execute this method
-
public class AccountAction {
-
@Restrict("#{s:hasRole('admin')}")
-
public void delete() {
-
// code
-
}
-
}
-
<!-- only users with "admin" role can see this UI component -->
-
<h:outputLink action="#{reports.listManagerReports}"
-
rendered="#{s:hasRole('admin')}">
-
Manager Reports
-
</h:outputLink>
PDF output
With the new PDF support, you can generate PDF documents, instead of XHTML pages, from Facelets view files. You can use the Seam stateful component model and JSF EL in the PDF. Just replace the XHTML component tags in regular web page with PDF tags, and you have a PDF output instead of a web page output. Extremely useful feature for sites that need to generate reports. Here is an example JSF page that outputs a PDF document with two chapters ...
-
<p:document xmlns:p="http://jboss.com/products/seam/pdf"
-
title="Hello">
-
-
<p:chapter number="1">
-
<p:title><p:paragraph>Hello</p:paragraph></p:title>
-
<p:paragraph>Hello #{user.name}!</p:paragraph>
-
</p:chapter>
-
-
<p:chapter number="2">
-
<p:title><p:paragraph>Goodbye</p:paragraph></p:title>
-
<p:paragraph>Goodbye #{user.name}.</p:paragraph>
-
</p:chapter>
-
-
</p:document>
Template-based email support
Sending email from your web application is not hard but it can be a messy task. The developer has to embed email text in Java code -- a major source of poorly worded email messages from applications. In Seam 1.1.5, we provide a template based approach to handle email. You can get your page designer to write email as if it is a web page. Then from Seam, you can execute a method to render the email and send it out. Here is an example email as a JSF view page:
-
<m:message xmlns="http://www.w3.org/1999/xhtml"
-
xmlns:m="http://jboss.com/products/seam/mail"
-
xmlns:h="http://java.sun.com/jsf/html">
-
-
<m:from name="Peter" address="peter@example.com" />
-
<m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
-
<m:subject>Try out Seam!</m:subject>
-
-
<m:body>
-
<p><h:outputText value="Dear #{person.firstname}" />,</p>
-
<p>You can try out Seam by visiting
-
<a href="http://labs.jboss.com/jbossseam">http://labs.jboss.com/jbossseam</a>.</p>
-
<p>Regards,</p>
-
<p>Peter</p>
-
</m:body>
-
</m:message>
And here is the code to actually send out the email to #{person.address}
Rich text support
Rich text support is a much needed feature in many web applications. But how do you trust rich text input from users? Obviously, you cannot allow them to enter arbitary HTML text as it opens up many security issues. Wiki text, on the other hand, is an excellent alternative. Seam 1.1.5 provide a UI component to convert wiki text from your database to HTML displays on a page on the fly. Nice feature if you are building a community oriented (a.k.a web 2.0) web site.
New JSF controls
Examples include <s:selectItems>, <s:selectDate>, and <s:fileUpload> etc.
WebSphere 6.1 compatible
From Seam 1.1.5, we will support Seam on the latest WebSphere application server. It may not sound like a big deal since we already support Seam on WebLogic, Tomcat, and Sun AS. But WebSphere is a beast that requires its own proprietary JDK to run -- it is a big deal that Seam works just fine on WebSphere 6.1