Re: PrettyFaces + Primefaces url trouble

Splash Forums PrettyFaces Users PrettyFaces + Primefaces url trouble Re: PrettyFaces + Primefaces url trouble

#23184

Yes, the post I referred to uses annotations instead of the XML configuration. You can choose which way you prefer. :)

Regarding your question:

@URLAction
public void init() {
// something
}

That’s not a JSF action method. It’s a method that gets invoked by PrettyFaces when the user accesses the pretty URL. So the method doesn’t require a return value.

And no, in your setup loadObject won’t be called with the ID. The id will be injected into the bean property you are referencing with your pattern. So in your case you could do something like this.

<url-mapping id="grupoEditor">
<pattern value="/grupo/#{ grupoController.id }" />
<action>#{ grupoController.loadObject}</action>
<view-id value="/view/grupo/form.jsf" />
</url-mapping>

And a bean like this:

public class GrupoController {

private Long id;

private Grupo grupo;

public void loadObject() {
this.grupo = someDao.loadById(id);
}

/* getters + setters */

}

You should have a look at this chapter of the PrettyFaces configuration:

http://ocpsoft.org/docs/prettyfaces/3.3.3/en-US/html/Configuration.html