Tag: JSF

Rational Application Developer and Websphere Portal Express

Posted by – January 8, 2009

I just started to use IBM RAD and IBM Websphere Portal few weeks back, IBM RAD is a very complete tool built on top of Eclipse, it has a lot of features that facilitates the work on portlet development, you can create in a few minutes a portlet using Struts or JSF as framework. Once a portlet is created you can build and package this portlet as WAR file to deploy on Websphere Portal.

Websphere Portal is completely updated portal solution, you can run JSR 168 and JSR 286 compliant portlets, you also have the option to create portlets using the IBM specific implementation that contains a lot of additional features.

The entire portal is fully customizable, you can change the portal appearance by adding new themes, all portlets can be added to a portal page by just drag and drop then on a page, access control can be easily done via deep integration with LDAP. You can even use google gadgets on your portal page!

Are you worried about scalability? Don’t worry, you can put several websphere portal instances running on a cluster mode.

Share

Creating a EL function to return browser name

Posted by – January 7, 2009

There are some situations where we need know the browser name to perform some changes on page code, the java code below defines a EL function to help on retrieve the browser name.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package br.eti.faces.el;

import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

public final class Browser {

    public static String name() {
        FacesContext context=FacesContext.getCurrentInstance();
        HttpServletRequest request=
           (HttpServletRequest)context.getExternalContext().
               getRequest();
        String useragent= request.getHeader("user-agent");
        useragent=useragent.toLowerCase();
        if (useragent.indexOf("opera")!=-1)
            return "opera";
        if (useragent.indexOf("netscape")!=-1)
            return "netscape";
        if (useragent.indexOf("msie")!=-1)
            return "ie";
        if (useragent.indexOf("firefox")!=-1)
            return "firefox";
    return "";
    }
}

More

Share

Facelets EL Functions can save your day

Posted by – November 2, 2008

In the last week I had several issues during the development of a jsf application that could be solved by creating few custom Facelets EL functions, let’s take a look on which scenarios Facelets EL functions helped me.

1. Simple loop over a range of numbers

JSF has a lot of components that can be used to iterate over a model and repeat its own child components several times, some of them are Tomahawk’s dataList and Richfaces repeat.

But in all of these components I couldn’t find a way to do a simple iteration on a range of numbers, like repeat all child components starting from 1 and stopping at n number of times.

Maybe you will say: “What about c:forEach? It can do this kind of iteration!”, oh yes, it can, and I tried to use it but it crashes when I pass EL expressions to both begin and end attributes, it only accepts hardcoded values.
More

Share

Back button issues with JSF and server side state saving

Posted by – October 27, 2008

For several months I tried to avoid this problem that only happens with server side state saving, but now I can’t run away anymore. Really sad.

I have a page that contains a dataList used to render a list of commandLinks, when I click on one of these commandLinks, the attached ActionListener gets called, but if I click on back button and then click on any other commandLink, the ActionListener attached to this component isn’t called, after several hours of debugging I discovered JSF are always trying to restore the current viewstate and not the viewstate related with the original version of my view.

JSF helped a lot on development of many projects, but now I’m really considering the use of Wicket on development of some search frontends that requires good back button support.

Share

Gracelets – DSL for JSF Applications

Posted by – September 15, 2008

Sometimes I remeber to visit TSS site to check some news about Java world, one of the threads that catch my attention was the article about use Raven to build Java projects, Raven allows to use your DSLs to write build files on top of Java language, with these DSLs you can do much more than any other build system like Ant but with less code.

You can define your own DSL to solve a specific problem, Raven uses a DSL to write builds scripts, but you can use DSLs to generate XML content, RSS content, HTML pages, SQL statements, create swing applications and to perform unit conversions.

But what about Gracelets? What’s it for?

More

Share